Cabal-2.2.0.1: A framework for packaging Haskell software

Safe HaskellNone
LanguageHaskell2010

Distribution.Parsec.Class

Contents

Synopsis

Documentation

class Parsec a where Source #

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

Minimal complete definition

parsec

Methods

parsec :: CabalParsing m => m a Source #

Instances

Parsec Bool Source # 

Methods

parsec :: CabalParsing m => m Bool Source #

Parsec Version Source # 
Parsec VersionRange Source # 
Parsec RepoType Source # 
Parsec RepoKind Source # 
Parsec PkgconfigName Source # 
Parsec ForeignLibType Source # 
Parsec ForeignLibOption Source # 
Parsec ExecutableScope Source # 
Parsec ComponentId Source # 
Parsec BuildType Source # 
Parsec AbiHash Source # 
Parsec Platform Source # 
Parsec Arch Source # 

Methods

parsec :: CabalParsing m => m Arch Source #

Parsec OS Source # 

Methods

parsec :: CabalParsing m => m OS Source #

Parsec LicenseRef Source # 
Parsec LicenseId Source #
>>> 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?"
Parsec LicenseExceptionId Source # 
Parsec SimpleLicenseExpression Source # 
Parsec LicenseExpression Source # 
Parsec License Source #
>>> 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
Parsec ModuleName Source # 
Parsec ModuleRenaming Source # 
Parsec IncludeRenaming Source # 
Parsec TestType Source # 
Parsec PkgconfigDependency Source # 
Parsec BenchmarkType Source # 
Parsec License Source # 
Parsec Extension Source # 
Parsec Language Source # 
Parsec CompilerFlavor Source # 
Parsec FilePathNT Source # 
Parsec FreeText Source # 
Parsec TestedWith Source # 
Parsec SpecLicense Source # 
Parsec SpecVersion Source # 
Parsec Token' Source # 

Methods

parsec :: CabalParsing m => m Token' Source #

Parsec Token Source # 

Methods

parsec :: CabalParsing m => m Token Source #

Parsec PackageName Source # 
Parsec UnqualComponentName Source # 
Parsec DefUnitId Source # 
Parsec UnitId Source #

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

Methods

parsec :: CabalParsing m => m UnitId Source #

Parsec Module Source # 

Methods

parsec :: CabalParsing m => m Module Source #

Parsec OpenModule Source #
>>> 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"]))
Parsec OpenUnitId Source #
>>> 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"]))]))
Parsec ModuleReexport Source # 
Parsec Mixin Source # 

Methods

parsec :: CabalParsing m => m Mixin Source #

Parsec ExeDependency Source # 
Parsec Dependency Source # 
Parsec MungedPackageName Source # 
Parsec AbiDependency Source # 
Parsec LegacyExeDependency Source # 
Parsec LibVersionInfo Source # 
Parsec FlagName Source # 
Parsec ExposedModule Source # 
Parsec TestShowDetails Source # 
Parsec a => Parsec (Identity a) Source # 

Methods

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

Parsec a => Parsec (MQuoted a) Source # 

Methods

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

(Newtype b a, Sep sep, Parsec b) => Parsec (List sep b a) Source # 

Methods

parsec :: CabalParsing m => m (List sep b a) Source #

newtype ParsecParser a Source #

Constructors

PP 

Instances

Monad ParsecParser Source # 
Functor ParsecParser Source # 

Methods

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

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

MonadFail ParsecParser Source # 

Methods

fail :: String -> ParsecParser a #

Applicative ParsecParser Source # 
Alternative ParsecParser Source # 
MonadPlus ParsecParser Source # 
Parsing ParsecParser Source # 
CharParsing ParsecParser Source # 
CabalParsing ParsecParser Source # 

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

parsec could consume trailing spaces, this function will consume.

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

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

CabalParsing & warnings

data PWarnType Source #

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 Source # 
Enum PWarnType Source # 
Eq PWarnType Source # 
Ord PWarnType Source # 
Show PWarnType Source # 
Generic PWarnType Source # 

Associated Types

type Rep PWarnType :: * -> * #

Binary PWarnType Source # 
NFData PWarnType Source # 

Methods

rnf :: PWarnType -> () #

type Rep PWarnType Source # 
type Rep PWarnType = D1 * (MetaData "PWarnType" "Distribution.Parsec.Common" "Cabal-2.2.0.1-48vP1nsJxGytpQcNK9dhM" 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 Source #

Content isn't unquoted

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

parsecMaybeQuoted p = parsecQuoted p | p.

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

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

Like parsecCommaList but accept leading or trailing comma.

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

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

Parse a benchmark/test-suite types.