Cabal-2.1.0.0: 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 # 
Instance details

Methods

parsec :: CabalParsing m => m Bool Source #

Parsec BuildType # 
Instance details
Parsec ExecutableScope # 
Instance details
Parsec ForeignLibOption # 
Instance details
Parsec ForeignLibType # 
Instance details
Parsec Version # 
Instance details
Parsec VersionRange # 
Instance details
Parsec PkgconfigName # 
Instance details
Parsec ComponentId # 
Instance details
Parsec AbiHash # 
Instance details
Parsec ModuleName # 
Instance details
Parsec ModuleRenaming # 
Instance details
Parsec IncludeRenaming # 
Instance details
Parsec RepoType # 
Instance details
Parsec RepoKind # 
Instance details
Parsec Platform # 
Instance details
Parsec Arch # 
Instance details

Methods

parsec :: CabalParsing m => m Arch Source #

Parsec OS # 
Instance details

Methods

parsec :: CabalParsing m => m OS Source #

Parsec LicenseRef # 
Instance details
Parsec LicenseId # 
Instance details
Parsec LicenseExceptionId # 
Instance details
Parsec SimpleLicenseExpression # 
Instance details
Parsec LicenseExpression # 
Instance details
Parsec License # 
Instance details
Parsec TestType # 
Instance details
Parsec PkgconfigDependency # 
Instance details
Parsec BenchmarkType # 
Instance details
Parsec License # 
Instance details
Parsec Extension # 
Instance details
Parsec Language # 
Instance details
Parsec CompilerFlavor # 
Instance details
Parsec FilePathNT # 
Instance details
Parsec FreeText # 
Instance details
Parsec TestedWith # 
Instance details
Parsec SpecLicense # 
Instance details
Parsec SpecVersion # 
Instance details
Parsec Token' # 
Instance details

Methods

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

Parsec Token # 
Instance details

Methods

parsec :: CabalParsing m => m Token Source #

Parsec PackageName # 
Instance details
Parsec UnqualComponentName # 
Instance details
Parsec DefUnitId # 
Instance details
Parsec UnitId #

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

Instance details

Methods

parsec :: CabalParsing m => m UnitId Source #

Parsec Module # 
Instance details

Methods

parsec :: CabalParsing m => m Module Source #

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
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
Parsec ModuleReexport # 
Instance details
Parsec Mixin # 
Instance details

Methods

parsec :: CabalParsing m => m Mixin Source #

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

Methods

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

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

Methods

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

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

Methods

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

newtype ParsecParser a Source #

Constructors

PP 
Instances
Monad ParsecParser # 
Instance details
Functor ParsecParser # 
Instance details

Methods

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

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

MonadFail ParsecParser # 
Instance details
Applicative ParsecParser # 
Instance details
Alternative ParsecParser # 
Instance details
MonadPlus ParsecParser # 
Instance details
Parsing ParsecParser # 
Instance details
CharParsing ParsecParser # 
Instance details
CabalParsing ParsecParser # 
Instance details

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

parsec could consume trailing spaces, this function will consume.

CabalParsing & warnings

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

Parsing class which

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

Minimal complete definition

parsecWarning, askCabalSpecVersion

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.

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.