HORIZON HASKELLDocslts/ghc-10.0.x04404a62026-10-19Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 04404a6 · 2026-10-19

ModuleCabal-syntax-3.18.1.0Haskell2010

Distribution.FieldGrammar.Newtypes

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

Contents
  1. List
  2. Modifiers
  3. Type
  4. Set
  5. NonEmpty
  6. Version & License
  7. Identifiers
Synopsis

List

valuealaList :: sep -> [a] -> List sep (Identity a) a

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

Example1 expression
:t alaList VCatalaList VCat :: [a] -> List VCat (Identity a) a
Example1 expression
:t alaList' FSep TokenalaList' FSep Token :: [String] -> List FSep Token String

Modifiers

datadata VCat

Vertical list with optional commas. Displayed with vcat.

Instances1Sep
  • Sep VCatDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
datadata FSep

Paragraph fill list with optional commas. Displayed with fsep.

Instances1Sep
  • Sep FSepDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
classclass Sep sep where
#

Methods

Instances5Sep
  • Sep CommaFSepDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • Sep CommaVCatDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • Sep FSepDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • Sep NoCommaFSepDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • Sep VCatDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes

Type

newtypenewtype List sep b a

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.18.1.0 · Distribution.FieldGrammar.Newtypes
  • (Newtype a b, Sep sep, Parsec b) => Parsec (List sep b a)Defined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • (Newtype a b, Sep sep, Pretty b) => Pretty (List sep b a)Defined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes

Set

valuealaSet :: sep -> Set a -> Set' sep (Identity a) a

alaSet and alaSet' are simply Set' constructor, with additional phantom arguments to constrain the resulting type

Example1 expression
:t alaSet VCatalaSet VCat :: Set a -> Set' VCat (Identity a) a
Example1 expression
:t alaSet' FSep TokenalaSet' FSep Token :: Set String -> Set' FSep Token String
Example1 expression
unpack' (alaSet' FSep Token) <$> eitherParsec "foo bar foo"Right (fromList ["bar","foo"])
newtypenewtype Set' sep b a

Like List, but for Set.

Instances3Newtype, Parsec, Pretty
  • Newtype (Set a) (Set' sep wrapper a)Defined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • (Newtype a b, Ord a, Sep sep, Parsec b) => Parsec (Set' sep b a)Defined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • (Newtype a b, Sep sep, Pretty b) => Pretty (Set' sep b a)Defined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes

NonEmpty

valuealaNonEmpty :: sep -> NonEmpty a -> NonEmpty' sep (Identity a) a

alaNonEmpty and alaNonEmpty' are simply NonEmpty' constructor, with additional phantom arguments to constrain the resulting type

Example1 expression
:t alaNonEmpty VCatalaNonEmpty VCat :: NonEmpty a -> NonEmpty' VCat (Identity a) a
Example1 expression
unpack' (alaNonEmpty' FSep Token) <$> eitherParsec "foo bar foo"Right ("foo" :| ["bar","foo"])

Version & License

newtypenewtype SpecVersion

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

There are few things to consider:

We have this newtype, as writing Parsec and Pretty instances for CabalSpecVersion would cause cycle in modules: Version -> CabalSpecVersion -> Parsec -> ...

Instances5Eq, Show, Parsec, Pretty, Newtype
newtypenewtype SpecLicense

SPDX License expression or legacy license

Instances5Eq, Show, Parsec, Pretty, Newtype

Identifiers

newtypenewtype Token

Haskell string or [^ ,]+

Constructors

Instances3Parsec, Pretty, Newtype
  • Parsec TokenDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • Pretty TokenDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • Newtype String TokenDefined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
newtypenewtype MQuoted a

Either "quoted" or un-quoted.

Constructors

Instances3Newtype, Parsec, Pretty
  • Newtype a (MQuoted a)Defined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • Parsec a => Parsec (MQuoted a)Defined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
  • Pretty a => Pretty (MQuoted a)Defined in Cabal-syntax-3.18.1.0 · Distribution.FieldGrammar.Newtypes
newtypenewtype SymbolicPathNT from (to :: FileOrDir)

Newtype for SymbolicPath, with a different Parsec instance to disallow empty paths.

Instances3Parsec, Pretty, Newtype
newtypenewtype RelativePathNT from (to :: FileOrDir)

Newtype for RelativePath, with a different Parsec instance to disallow empty paths but allow non-relative paths (which get rejected later with a different error message, see Distribution.PackageDescription.Check.Paths.checkPath)

Instances3Parsec, Pretty, Newtype