Distribution.Parsec.Newtypes

Cabal-2.5.0.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Parsec.Newtypes

Contents

- List
  - Modifiers
  - Type
- Version & License
- Identifiers

Description

This module provides `newtype` wrappers to be used with Distribution.FieldGrammar.

Synopsis

- alaList :: sep -> [a] -> List sep (Identity a) a
- alaList' :: sep -> (a -> b) -> [a] -> List sep b a
- data CommaVCat = CommaVCat
- data CommaFSep = CommaFSep
- data VCat = VCat
- data FSep = FSep
- data NoCommaFSep = NoCommaFSep
- data List sep b a
- newtype SpecVersion = SpecVersion {
  - getSpecVersion :: Either Version VersionRange
  }
- newtype TestedWith = TestedWith {
  - getTestedWith :: (CompilerFlavor, VersionRange)
  }
- newtype SpecLicense = SpecLicense {
  - getSpecLicense :: Either License License
  }
- newtype Token = Token {
  - getToken :: String
  }
- newtype Token' = Token' {
  - getToken' :: String
  }
- newtype MQuoted a = MQuoted {
  - getMQuoted :: a
  }
- newtype FreeText = FreeText {
  - getFreeText :: String
  }
- newtype FilePathNT = FilePathNT {
  - getFilePathNT :: String
  }

# List

alaList :: sep -> [a] -> List sep (Identity a) a Source #

`alaList` and `alaList'` are simply `List`, with additional phantom arguments to constraint the resulting type

    >>> :t alaList VCat
    alaList VCat :: [a] -> List VCat (Identity a) a

    >>> :t alaList' FSep Token
    alaList' FSep Token :: [String] -> List FSep Token String

alaList' :: sep -> (a -> b) -> [a] -> List sep b a Source #

More general version of `alaList`.

## Modifiers

data CommaVCat Source #

Vertical list with commas. Displayed with `vcat`

Constructors

CommaVCat |

data CommaFSep Source #

Paragraph fill list with commas. Displayed with `fsep`

Constructors

CommaFSep |

data VCat Source #

Vertical list with optional commas. Displayed with `vcat`.

Constructors

VCat |

data FSep Source #

Paragraph fill list with optional commas. Displayed with `fsep`.

Constructors

FSep |

data NoCommaFSep Source #

Paragraph fill list without commas. Displayed with `fsep`.

Constructors

NoCommaFSep |

## Type

data List sep b a Source #

List separated with optional commas. Displayed with `sep`, arguments of type `a` are parsed and pretty-printed as `b`.

#### Instances

Instances details

(Newtype b a, Sep sep, Pretty b) => Pretty (List sep b a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: List sep b a -> Doc Source #
(Newtype b a, Sep sep, Parsec b) => Parsec (List sep b a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m (List sep b a) Source #
Newtype (List sep wrapper a) [a] # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: [a] -> List sep wrapper a Source # unpack :: List sep wrapper a -> [a] Source #

# Version & License

newtype SpecVersion Source #

Version range or just version, i.e. `cabal-version` field.

There are few things to consider:

- Starting with 2.2 the cabal-version field should be the first field in the file and only exact version is accepted. Therefore if we get e.g. `>= 2.2`, we fail. See https://github.com/haskell/cabal/issues/4899

Constructors

SpecVersion |
Fields getSpecVersion :: Either Version VersionRange

#### Instances

Instances details

Pretty SpecVersion # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: SpecVersion -> Doc Source #
Parsec SpecVersion # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m SpecVersion Source #
Newtype SpecVersion (Either Version VersionRange) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: Either Version VersionRange -> SpecVersion Source # unpack :: SpecVersion -> Either Version VersionRange Source #

newtype TestedWith Source #

Version range or just version

Constructors

TestedWith |
Fields getTestedWith :: (CompilerFlavor, VersionRange)

#### Instances

Instances details

Pretty TestedWith # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: TestedWith -> Doc Source #
Parsec TestedWith # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m TestedWith Source #
Newtype TestedWith (CompilerFlavor, VersionRange) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: (CompilerFlavor, VersionRange) -> TestedWith Source # unpack :: TestedWith -> (CompilerFlavor, VersionRange) Source #

newtype SpecLicense Source #

SPDX License expression or legacy license

Constructors

SpecLicense |
Fields getSpecLicense :: Either License License

#### Instances

Instances details

Pretty SpecLicense # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: SpecLicense -> Doc Source #
Parsec SpecLicense # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m SpecLicense Source #
Newtype SpecLicense (Either License License) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: Either License0 License -> SpecLicense Source # unpack :: SpecLicense -> Either License0 License Source #

# Identifiers

newtype Token Source #

Haskell string or `[^ ,]+`

Constructors

Token |
Fields getToken :: String

#### Instances

Instances details

Pretty Token # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: Token -> Doc Source #
Parsec Token # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m Token Source #
Newtype Token String # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: String -> Token Source # unpack :: Token -> String Source #

newtype Token' Source #

Haskell string or `[^ ]+`

Constructors

Token' |
Fields getToken' :: String

#### Instances

Instances details

Pretty Token' # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: Token' -> Doc Source #
Parsec Token' # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m Token' Source #
Newtype Token' String # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: String -> Token' Source # unpack :: Token' -> String Source #

newtype MQuoted a Source #

Either `"quoted"` or `un-quoted`.

Constructors

MQuoted |
Fields getMQuoted :: a

#### Instances

Instances details

Pretty a => Pretty (MQuoted a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: MQuoted a -> Doc Source #
Parsec a => Parsec (MQuoted a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m (MQuoted a) Source #
Newtype (MQuoted a) a # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: a -> MQuoted a Source # unpack :: MQuoted a -> a Source #

newtype FreeText Source #

This is almost ``many` `anyChar``, but it

- trims whitespace from ends of the lines,
- converts lines with only single dot into empty line.

Constructors

FreeText |
Fields getFreeText :: String

#### Instances

Instances details

Pretty FreeText # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: FreeText -> Doc Source #
Parsec FreeText # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m FreeText Source #
Newtype FreeText String # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: String -> FreeText Source # unpack :: FreeText -> String Source #

newtype FilePathNT Source #

Filepath are parsed as `Token`.

Constructors

FilePathNT |
Fields getFilePathNT :: String

#### Instances

Instances details

Pretty FilePathNT # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pretty :: FilePathNT -> Doc Source #
Parsec FilePathNT # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m FilePathNT Source #
Newtype FilePathNT String # |
Instance details Defined in Distribution.Parsec.Newtypes Methods pack :: String -> FilePathNT Source # unpack :: FilePathNT -> String Source #