Cabal-2.4.1.0: A framework for packaging Haskell software

Safe HaskellNone
LanguageHaskell2010

Distribution.Parsec.Class

Contents

Synopsis

Documentation

class Parsec a where #

Class for parsing with parsec. Mainly used for .cabal file fields.

Minimal complete definition

parsec

Methods

parsec :: CabalParsing m => m a #

Instances
Parsec Bool # 
Instance details

Defined in Distribution.Parsec.Class

Methods

parsec :: CabalParsing m => m Bool #

Parsec Version # 
Instance details

Defined in Distribution.Types.Version

Methods

parsec :: CabalParsing m => m Version #

Parsec VersionRange # 
Instance details

Defined in Distribution.Types.VersionRange

Parsec RepoType # 
Instance details

Defined in Distribution.Types.SourceRepo

Methods

parsec :: CabalParsing m => m RepoType #

Parsec RepoKind # 
Instance details

Defined in Distribution.Types.SourceRepo

Methods

parsec :: CabalParsing m => m RepoKind #

Parsec PkgconfigName # 
Instance details

Defined in Distribution.Types.PkgconfigName

Parsec ForeignLibType # 
Instance details

Defined in Distribution.Types.ForeignLibType

Parsec ForeignLibOption # 
Instance details

Defined in Distribution.Types.ForeignLibOption

Parsec ExecutableScope # 
Instance details

Defined in Distribution.Types.ExecutableScope

Parsec ComponentId # 
Instance details

Defined in Distribution.Types.ComponentId

Methods

parsec :: CabalParsing m => m ComponentId #

Parsec BuildType # 
Instance details

Defined in Distribution.Types.BuildType

Methods

parsec :: CabalParsing m => m BuildType #

Parsec AbiHash # 
Instance details

Defined in Distribution.Types.AbiHash

Methods

parsec :: CabalParsing m => m AbiHash #

Parsec Platform # 
Instance details

Defined in Distribution.System

Methods

parsec :: CabalParsing m => m Platform #

Parsec Arch # 
Instance details

Defined in Distribution.System

Methods

parsec :: CabalParsing m => m Arch #

Parsec OS # 
Instance details

Defined in Distribution.System

Methods

parsec :: CabalParsing m => m OS #

Parsec LicenseRef # 
Instance details

Defined in Distribution.SPDX.LicenseReference

Methods

parsec :: CabalParsing m => m LicenseRef #

Parsec LicenseId #
>>> eitherParsec "BSD-3-Clause" :: Either String LicenseId
Right BSD_3_Clause
>>> eitherParsec "BSD3" :: Either String LicenseId
Left "...Unknown SPDX license identifier: 'BSD3' Do you mean BSD-3-Clause?"
Instance details

Defined in Distribution.SPDX.LicenseId

Methods

parsec :: CabalParsing m => m LicenseId #

Parsec LicenseExceptionId # 
Instance details

Defined in Distribution.SPDX.LicenseExceptionId

Parsec SimpleLicenseExpression # 
Instance details

Defined in Distribution.SPDX.LicenseExpression

Parsec LicenseExpression # 
Instance details

Defined in Distribution.SPDX.LicenseExpression

Parsec License #
>>> eitherParsec "BSD-3-Clause AND MIT" :: Either String License
Right (License (EAnd (ELicense (ELicenseId BSD_3_Clause) Nothing) (ELicense (ELicenseId MIT) Nothing)))
>>> eitherParsec "NONE" :: Either String License
Right NONE
Instance details

Defined in Distribution.SPDX.License

Methods

parsec :: CabalParsing m => m License #

Parsec ModuleName # 
Instance details

Defined in Distribution.ModuleName

Methods

parsec :: CabalParsing m => m ModuleName #

Parsec ModuleRenaming # 
Instance details

Defined in Distribution.Types.ModuleRenaming

Parsec IncludeRenaming # 
Instance details

Defined in Distribution.Types.IncludeRenaming

Parsec TestType # 
Instance details

Defined in Distribution.Types.TestType

Methods

parsec :: CabalParsing m => m TestType #

Parsec PkgconfigDependency # 
Instance details

Defined in Distribution.Types.PkgconfigDependency

Parsec BenchmarkType # 
Instance details

Defined in Distribution.Types.BenchmarkType

Parsec License # 
Instance details

Defined in Distribution.License

Methods

parsec :: CabalParsing m => m License #

Parsec Extension # 
Instance details

Defined in Language.Haskell.Extension

Methods

parsec :: CabalParsing m => m Extension #

Parsec Language # 
Instance details

Defined in Language.Haskell.Extension

Methods

parsec :: CabalParsing m => m Language #

Parsec CompilerFlavor # 
Instance details

Defined in Distribution.Compiler

Parsec FilePathNT # 
Instance details

Defined in Distribution.Parsec.Newtypes

Methods

parsec :: CabalParsing m => m FilePathNT #

Parsec FreeText # 
Instance details

Defined in Distribution.Parsec.Newtypes

Methods

parsec :: CabalParsing m => m FreeText #

Parsec TestedWith # 
Instance details

Defined in Distribution.Parsec.Newtypes

Methods

parsec :: CabalParsing m => m TestedWith #

Parsec SpecLicense # 
Instance details

Defined in Distribution.Parsec.Newtypes

Methods

parsec :: CabalParsing m => m SpecLicense #

Parsec SpecVersion # 
Instance details

Defined in Distribution.Parsec.Newtypes

Methods

parsec :: CabalParsing m => m SpecVersion #

Parsec Token' # 
Instance details

Defined in Distribution.Parsec.Newtypes

Methods

parsec :: CabalParsing m => m Token' #

Parsec Token # 
Instance details

Defined in Distribution.Parsec.Newtypes

Methods

parsec :: CabalParsing m => m Token #

Parsec PackageName # 
Instance details

Defined in Distribution.Types.PackageName

Methods

parsec :: CabalParsing m => m PackageName #

Parsec UnqualComponentName # 
Instance details

Defined in Distribution.Types.UnqualComponentName

Parsec PackageIdentifier # 
Instance details

Defined in Distribution.Types.PackageId

Parsec DefUnitId # 
Instance details

Defined in Distribution.Types.UnitId

Methods

parsec :: CabalParsing m => m DefUnitId #

Parsec UnitId #

The textual format for UnitId coincides with the format GHC accepts for -package-id.

Instance details

Defined in Distribution.Types.UnitId

Methods

parsec :: CabalParsing m => m UnitId #

Parsec Module # 
Instance details

Defined in Distribution.Types.Module

Methods

parsec :: CabalParsing m => m Module #

Parsec OpenModule #
>>> eitherParsec "Includes2-0.1.0.0-inplace-mysql:Database.MySQL" :: Either String OpenModule
Right (OpenModule (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "Includes2-0.1.0.0-inplace-mysql"})) (ModuleName ["Database","MySQL"]))
Instance details

Defined in Distribution.Backpack

Methods

parsec :: CabalParsing m => m OpenModule #

Parsec OpenUnitId #
>>> eitherParsec "foobar" :: Either String OpenUnitId
Right (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "foobar"}))
>>> eitherParsec "foo[Str=text-1.2.3:Data.Text.Text]" :: Either String OpenUnitId
Right (IndefFullUnitId (ComponentId "foo") (fromList [(ModuleName ["Str"],OpenModule (DefiniteUnitId (DefUnitId {unDefUnitId = UnitId "text-1.2.3"})) (ModuleName ["Data","Text","Text"]))]))
Instance details

Defined in Distribution.Backpack

Methods

parsec :: CabalParsing m => m OpenUnitId #

Parsec ModuleReexport # 
Instance details

Defined in Distribution.Types.ModuleReexport

Parsec Mixin # 
Instance details

Defined in Distribution.Types.Mixin

Methods

parsec :: CabalParsing m => m Mixin #

Parsec ExeDependency # 
Instance details

Defined in Distribution.Types.ExeDependency

Parsec Dependency # 
Instance details

Defined in Distribution.Types.Dependency

Methods

parsec :: CabalParsing m => m Dependency #

Parsec MungedPackageName # 
Instance details

Defined in Distribution.Types.MungedPackageName

Parsec AbiDependency # 
Instance details

Defined in Distribution.Types.AbiDependency

Parsec LegacyExeDependency # 
Instance details

Defined in Distribution.Types.LegacyExeDependency

Parsec LibVersionInfo # 
Instance details

Defined in Distribution.Types.ForeignLib

Parsec FlagName # 
Instance details

Defined in Distribution.Types.GenericPackageDescription

Methods

parsec :: CabalParsing m => m FlagName #

Parsec ExposedModule # 
Instance details

Defined in Distribution.Types.ExposedModule

Parsec TestShowDetails # 
Instance details

Defined in Distribution.Simple.Setup

Parsec a => Parsec (Identity a) # 
Instance details

Defined in Distribution.Parsec.Class

Methods

parsec :: CabalParsing m => m (Identity a) #

Parsec a => Parsec (MQuoted a) # 
Instance details

Defined in Distribution.Parsec.Newtypes

Methods

parsec :: CabalParsing m => m (MQuoted a) #

(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) #

newtype ParsecParser a #

Constructors

PP 
Instances
Monad ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

Functor ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

Methods

fmap :: (a -> b) -> ParsecParser a -> ParsecParser b #

(<$) :: a -> ParsecParser b -> ParsecParser a #

MonadFail ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

Methods

fail :: String -> ParsecParser a #

Applicative ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

Alternative ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

MonadPlus ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

Parsing ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

CharParsing ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

CabalParsing ParsecParser # 
Instance details

Defined in Distribution.Parsec.Class

simpleParsec :: Parsec a => String -> Maybe a #

Parse a String with lexemeParsec.

lexemeParsec :: (CabalParsing m, Parsec a) => m a #

parsec could consume trailing spaces, this function will consume.

explicitEitherParsec :: ParsecParser a -> String -> Either String a #

Parse a String with given ParsecParser. Trailing whitespace is accepted.

CabalParsing & warnings

class (CharParsing m, MonadPlus m) => CabalParsing m where #

Parsing class which

  • can report Cabal parser warnings.
  • knows cabal-version we work with

Minimal complete definition

parsecWarning, askCabalSpecVersion

data PWarnType #

Type of parser warning. We do classify warnings.

Different application may decide not to show some, or have fatal behaviour on others

Constructors

PWTOther

Unclassified warning

PWTUTF

Invalid UTF encoding

PWTBoolCase

true or false, not True or False

PWTVersionTag

there are version with tags

PWTNewSyntax

New syntax used, but no cabal-version: >= 1.2 specified

PWTOldSyntax

Old syntax used, and cabal-version >= 1.2 specified

PWTDeprecatedField 
PWTInvalidSubsection 
PWTUnknownField 
PWTUnknownSection 
PWTTrailingFields 
PWTExtraMainIs

extra main-is field

PWTExtraTestModule

extra test-module field

PWTExtraBenchmarkModule

extra benchmark-module field

PWTLexNBSP 
PWTLexBOM 
PWTLexTab 
PWTQuirkyCabalFile

legacy cabal file that we know how to patch

PWTDoubleDash

Double dash token, most likely it's a mistake - it's not a comment

PWTMultipleSingularField

e.g. name or version should be specified only once.

PWTBuildTypeDefault

Workaround for derive-package having build-type: Default. See https://github.com/haskell/cabal/issues/5020.

PWTVersionLeadingZeros

See https://github.com/haskell-infra/hackage-trustees/issues/128

Instances
Bounded PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

Enum PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

Eq PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

Ord PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

Show PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

Generic PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

Associated Types

type Rep PWarnType :: * -> * #

Binary PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

NFData PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

Methods

rnf :: PWarnType -> () #

type Rep PWarnType # 
Instance details

Defined in Distribution.Parsec.Common

type Rep PWarnType = D1 (MetaData "PWarnType" "Distribution.Parsec.Common" "Cabal-2.4.1.0-ALhzvdqe44A7vLWPOxSupv" False) ((((C1 (MetaCons "PWTOther" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PWTUTF" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "PWTBoolCase" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "PWTVersionTag" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PWTNewSyntax" PrefixI False) (U1 :: * -> *)))) :+: ((C1 (MetaCons "PWTOldSyntax" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "PWTDeprecatedField" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PWTInvalidSubsection" PrefixI False) (U1 :: * -> *))) :+: (C1 (MetaCons "PWTUnknownField" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "PWTUnknownSection" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PWTTrailingFields" PrefixI False) (U1 :: * -> *))))) :+: (((C1 (MetaCons "PWTExtraMainIs" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PWTExtraTestModule" PrefixI False) (U1 :: * -> *)) :+: (C1 (MetaCons "PWTExtraBenchmarkModule" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "PWTLexNBSP" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PWTLexBOM" PrefixI False) (U1 :: * -> *)))) :+: ((C1 (MetaCons "PWTLexTab" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "PWTQuirkyCabalFile" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PWTDoubleDash" PrefixI False) (U1 :: * -> *))) :+: (C1 (MetaCons "PWTMultipleSingularField" PrefixI False) (U1 :: * -> *) :+: (C1 (MetaCons "PWTBuildTypeDefault" PrefixI False) (U1 :: * -> *) :+: C1 (MetaCons "PWTVersionLeadingZeros" PrefixI False) (U1 :: * -> *))))))

Utilities

parsecQuoted :: CabalParsing m => m a -> m a #

Content isn't unquoted

parsecMaybeQuoted :: CabalParsing m => m a -> m a #

parsecMaybeQuoted p = parsecQuoted p | p.

parsecCommaList :: CabalParsing m => m a -> m [a] #

parsecLeadingCommaList :: CabalParsing m => m a -> m [a] #

Like parsecCommaList but accept leading or trailing comma.

p (comma p)*  -- p sepBy comma
(comma p)*    -- leading comma
(p comma)*    -- trailing comma

parsecOptCommaList :: CabalParsing m => m a -> m [a] #

parsecStandard :: (CabalParsing m, Parsec ver) => (ver -> String -> a) -> m a #

Parse a benchmark/test-suite types.