ModuleCabal-syntax-3.12.1.0Haskell2010
Distribution.FieldGrammar.Newtypes
This module provides newtype wrappers to be used with Distribution.FieldGrammar.
- 15 types
- 1 class
- 6 values
- PackageCabal-syntax-3.12.1.0
- Exports22
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourceNewtypes.hs
List
2 declarationsMore general version of alaList.
Modifiers
Paragraph fill list without commas. Displayed with fsep.
Instances1Sep
Sep NoCommaFSepDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes
Methods
prettySep :: Proxy sep -> [Doc] -> DocparseSep :: CabalParsing m => Proxy sep -> m a -> m [a]parseSepNE :: CabalParsing m => Proxy sep -> m a -> m (NonEmpty a)
Instances5Sep
Sep CommaFSepDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesSep CommaVCatDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesSep FSepDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesSep NoCommaFSepDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesSep VCatDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes
Type
List separated with optional commas. Displayed with sep, arguments of
type a are parsed and pretty-printed as b.
Instances3Newtype, Parsec, Pretty
Newtype [a] (List sep wrapper a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes(Newtype a b, Sep sep, Parsec b) => Parsec (List sep b a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes(Newtype a b, Sep sep, Pretty b) => Pretty (List sep b a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes
Set
alaSet and alaSet' are simply Set' constructor, with additional phantom arguments to constrain the resulting type
:t alaSet VCatalaSet VCat :: Set a -> Set' VCat (Identity a) a
:t alaSet' FSep TokenalaSet' FSep Token :: Set String -> Set' FSep Token String
unpack' (alaSet' FSep Token) <$> eitherParsec "foo bar foo"Right (fromList ["bar","foo"])
More general version of alaSet.
Instances3Newtype, Parsec, Pretty
Newtype (Set a) (Set' sep wrapper a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes(Newtype a b, Ord a, Sep sep, Parsec b) => Parsec (Set' sep b a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes(Newtype a b, Sep sep, Pretty b) => Pretty (Set' sep b a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes
NonEmpty
alaNonEmpty and alaNonEmpty' are simply NonEmpty' constructor, with additional phantom arguments to constrain the resulting type
:t alaNonEmpty VCatalaNonEmpty VCat :: NonEmpty a -> NonEmpty' VCat (Identity a) a
unpack' (alaNonEmpty' FSep Token) <$> eitherParsec "foo bar foo"Right ("foo" :| ["bar","foo"])
More general version of alaNonEmpty.
Instances3Newtype, Parsec, Pretty
Newtype (NonEmpty a) (NonEmpty' sep wrapper a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes(Newtype a b, Sep sep, Parsec b) => Parsec (NonEmpty' sep b a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes(Newtype a b, Sep sep, Pretty b) => Pretty (NonEmpty' sep b a)Defined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes
Version & License
3 declarationsVersion 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
We have this newtype, as writing Parsec and Pretty instances for CabalSpecVersion would cause cycle in modules: Version -> CabalSpecVersion -> Parsec -> ...
Constructors
Instances5Eq, Show, Parsec, Pretty, Newtype
Eq SpecVersionDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesShow SpecVersionDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesParsec SpecVersionDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesPretty SpecVersionDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesNewtype CabalSpecVersion SpecVersionDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes
Version range or just version
Constructors
Instances3Parsec, Pretty, Newtype
Parsec TestedWithDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesPretty TestedWithDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesNewtype (CompilerFlavor, VersionRange) TestedWithDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes
SPDX License expression or legacy license
Constructors
Instances5Eq, Show, Parsec, Pretty, Newtype
Eq SpecLicenseDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesShow SpecLicenseDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesParsec SpecLicenseDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesPretty SpecLicenseDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesNewtype (Either License License) SpecLicenseDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes
Identifiers
4 declarationsEither "quoted" or un-quoted.
Constructors
MQuotedgetMQuoted :: a
Instances3Newtype, Parsec, Pretty
Filepath are parsed as Token.
Constructors
Instances3Parsec, Pretty, Newtype
Parsec FilePathNTDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesPretty FilePathNTDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.NewtypesNewtype String FilePathNTDefined in Cabal-syntax-3.12.1.0 · Distribution.FieldGrammar.Newtypes