Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class Parsec a where
- parsec :: CabalParsing m => m a
- newtype ParsecParser a = PP {
- unPP :: CabalSpecVersion -> Parsec FieldLineStream [PWarning] a
- runParsecParser :: ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a
- runParsecParser' :: CabalSpecVersion -> ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a
- simpleParsec :: Parsec a => String -> Maybe a
- lexemeParsec :: (CabalParsing m, Parsec a) => m a
- eitherParsec :: Parsec a => String -> Either String a
- explicitEitherParsec :: ParsecParser a -> String -> Either String a
- class (CharParsing m, MonadPlus m, MonadFail m) => CabalParsing m where
- parsecWarning :: PWarnType -> String -> m ()
- parsecHaskellString :: m String
- askCabalSpecVersion :: m CabalSpecVersion
- data PWarnType
- = PWTOther
- | PWTUTF
- | PWTBoolCase
- | PWTVersionTag
- | PWTNewSyntax
- | PWTOldSyntax
- | PWTDeprecatedField
- | PWTInvalidSubsection
- | PWTUnknownField
- | PWTUnknownSection
- | PWTTrailingFields
- | PWTExtraMainIs
- | PWTExtraTestModule
- | PWTExtraBenchmarkModule
- | PWTLexNBSP
- | PWTLexBOM
- | PWTLexTab
- | PWTQuirkyCabalFile
- | PWTDoubleDash
- | PWTMultipleSingularField
- | PWTBuildTypeDefault
- data PWarning = PWarning !PWarnType !Position String
- showPWarning :: FilePath -> PWarning -> String
- data PError = PError Position String
- showPError :: FilePath -> PError -> String
- data Position = Position !Int !Int
- incPos :: Int -> Position -> Position
- retPos :: Position -> Position
- showPos :: Position -> String
- zeroPos :: Position
- parsecToken :: CabalParsing m => m String
- parsecToken' :: CabalParsing m => m String
- parsecFilePath :: CabalParsing m => m FilePath
- parsecQuoted :: CabalParsing m => m a -> m a
- parsecMaybeQuoted :: CabalParsing m => m a -> m a
- parsecCommaList :: CabalParsing m => m a -> m [a]
- parsecLeadingCommaList :: CabalParsing m => m a -> m [a]
- parsecOptCommaList :: CabalParsing m => m a -> m [a]
- parsecLeadingOptCommaList :: CabalParsing m => m a -> m [a]
- parsecStandard :: (CabalParsing m, Parsec ver) => (ver -> String -> a) -> m a
- parsecUnqualComponentName :: CabalParsing m => m String
Documentation
Class for parsing with parsec
. Mainly used for .cabal
file fields.
For parsing .cabal
like file structure, see Distribution.Fields.
parsec :: CabalParsing m => m a Source #
Instances
Parsec Bool # | |
Defined in Distribution.Parsec parsec :: CabalParsing m => m Bool Source # | |
Parsec Version # | |
Defined in Distribution.Types.Version parsec :: CabalParsing m => m Version Source # | |
Parsec VersionRange # | |
Defined in Distribution.Types.VersionRange.Internal parsec :: CabalParsing m => m VersionRange Source # | |
Parsec RepoType # | |
Defined in Distribution.Types.SourceRepo parsec :: CabalParsing m => m RepoType Source # | |
Parsec RepoKind # | |
Defined in Distribution.Types.SourceRepo parsec :: CabalParsing m => m RepoKind Source # | |
Parsec PkgconfigVersion # |
|
Defined in Distribution.Types.PkgconfigVersion parsec :: CabalParsing m => m PkgconfigVersion Source # | |
Parsec PkgconfigVersionRange # | |
Defined in Distribution.Types.PkgconfigVersionRange parsec :: CabalParsing m => m PkgconfigVersionRange Source # | |
Parsec PkgconfigName # | |
Defined in Distribution.Types.PkgconfigName parsec :: CabalParsing m => m PkgconfigName Source # | |
Parsec PkgconfigDependency # | |
Defined in Distribution.Types.PkgconfigDependency parsec :: CabalParsing m => m PkgconfigDependency Source # | |
Parsec PackageName # | |
Defined in Distribution.Types.PackageName parsec :: CabalParsing m => m PackageName Source # | |
Parsec UnqualComponentName # | |
Defined in Distribution.Types.UnqualComponentName parsec :: CabalParsing m => m UnqualComponentName Source # | |
Parsec PackageVersionConstraint # | |
Defined in Distribution.Types.PackageVersionConstraint parsec :: CabalParsing m => m PackageVersionConstraint Source # | |
Parsec LibraryVisibility # | |
Defined in Distribution.Types.LibraryVisibility parsec :: CabalParsing m => m LibraryVisibility Source # | |
Parsec MungedPackageName # |
|
Defined in Distribution.Types.MungedPackageName parsec :: CabalParsing m => m MungedPackageName Source # | |
Parsec ForeignLibType # | |
Defined in Distribution.Types.ForeignLibType parsec :: CabalParsing m => m ForeignLibType Source # | |
Parsec ForeignLibOption # | |
Defined in Distribution.Types.ForeignLibOption parsec :: CabalParsing m => m ForeignLibOption Source # | |
Parsec FlagName # | |
Defined in Distribution.Types.Flag parsec :: CabalParsing m => m FlagName Source # | |
Parsec ExecutableScope # | |
Defined in Distribution.Types.ExecutableScope parsec :: CabalParsing m => m ExecutableScope Source # | |
Parsec ComponentName # | |
Defined in Distribution.Types.ComponentName parsec :: CabalParsing m => m ComponentName Source # | |
Parsec ComponentId # | |
Defined in Distribution.Types.ComponentId parsec :: CabalParsing m => m ComponentId Source # | |
Parsec BuildType # | |
Defined in Distribution.Types.BuildType parsec :: CabalParsing m => m BuildType Source # | |
Parsec AbiHash # | |
Defined in Distribution.Types.AbiHash parsec :: CabalParsing m => m AbiHash Source # | |
Parsec Platform # | |
Defined in Distribution.System parsec :: CabalParsing m => m Platform Source # | |
Parsec Arch # | |
Defined in Distribution.System parsec :: CabalParsing m => m Arch Source # | |
Parsec OS # | |
Defined in Distribution.System parsec :: CabalParsing m => m OS Source # | |
Parsec LicenseRef # | |
Defined in Distribution.SPDX.LicenseReference parsec :: CabalParsing m => m LicenseRef Source # | |
Parsec LicenseId # |
|
Defined in Distribution.SPDX.LicenseId parsec :: CabalParsing m => m LicenseId Source # | |
Parsec LicenseExceptionId # | |
Defined in Distribution.SPDX.LicenseExceptionId parsec :: CabalParsing m => m LicenseExceptionId Source # | |
Parsec SimpleLicenseExpression # | |
Defined in Distribution.SPDX.LicenseExpression parsec :: CabalParsing m => m SimpleLicenseExpression Source # | |
Parsec LicenseExpression # | |
Defined in Distribution.SPDX.LicenseExpression parsec :: CabalParsing m => m LicenseExpression Source # | |
Parsec License # |
|
Defined in Distribution.SPDX.License parsec :: CabalParsing m => m License Source # | |
Parsec ModuleName # | |
Defined in Distribution.ModuleName parsec :: CabalParsing m => m ModuleName Source # | |
Parsec ModuleRenaming # | |
Defined in Distribution.Types.ModuleRenaming parsec :: CabalParsing m => m ModuleRenaming Source # | |
Parsec IncludeRenaming # | |
Defined in Distribution.Types.IncludeRenaming parsec :: CabalParsing m => m IncludeRenaming Source # | |
Parsec Mixin # | |
Defined in Distribution.Types.Mixin parsec :: CabalParsing m => m Mixin Source # | |
Parsec ModuleReexport # | |
Defined in Distribution.Types.ModuleReexport parsec :: CabalParsing m => m ModuleReexport Source # | |
Parsec TestType # | |
Defined in Distribution.Types.TestType parsec :: CabalParsing m => m TestType Source # | |
Parsec PackageIdentifier # |
Note: Stricter than
|
Defined in Distribution.Types.PackageId parsec :: CabalParsing m => m PackageIdentifier Source # | |
Parsec DefUnitId # | |
Defined in Distribution.Types.UnitId parsec :: CabalParsing m => m DefUnitId Source # | |
Parsec UnitId # | The textual format for |
Defined in Distribution.Types.UnitId parsec :: CabalParsing m => m UnitId Source # | |
Parsec Module # | |
Defined in Distribution.Types.Module parsec :: CabalParsing m => m Module Source # | |
Parsec OpenModule # |
|
Defined in Distribution.Backpack parsec :: CabalParsing m => m OpenModule Source # | |
Parsec OpenUnitId # |
|
Defined in Distribution.Backpack parsec :: CabalParsing m => m OpenUnitId Source # | |
Parsec ExposedModule # | |
Defined in Distribution.Types.ExposedModule parsec :: CabalParsing m => m ExposedModule Source # | |
Parsec MungedPackageId # |
|
Defined in Distribution.Types.MungedPackageId parsec :: CabalParsing m => m MungedPackageId Source # | |
Parsec LegacyExeDependency # | |
Defined in Distribution.Types.LegacyExeDependency parsec :: CabalParsing m => m LegacyExeDependency Source # | |
Parsec ExeDependency # | Examples
|
Defined in Distribution.Types.ExeDependency parsec :: CabalParsing m => m ExeDependency Source # | |
Parsec Dependency # |
Spaces around colon are not allowed:
|
Defined in Distribution.Types.Dependency parsec :: CabalParsing m => m Dependency Source # | |
Parsec BenchmarkType # | |
Defined in Distribution.Types.BenchmarkType parsec :: CabalParsing m => m BenchmarkType Source # | |
Parsec AbiDependency # | |
Defined in Distribution.Types.AbiDependency parsec :: CabalParsing m => m AbiDependency Source # | |
Parsec License # | |
Defined in Distribution.License parsec :: CabalParsing m => m License Source # | |
Parsec Extension # | |
Defined in Language.Haskell.Extension parsec :: CabalParsing m => m Extension Source # | |
Parsec Language # | |
Defined in Language.Haskell.Extension parsec :: CabalParsing m => m Language Source # | |
Parsec AbiTag # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m AbiTag Source # | |
Parsec CompilerId # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m CompilerId Source # | |
Parsec CompilerFlavor # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m CompilerFlavor Source # | |
Parsec LibVersionInfo # | |
Defined in Distribution.Types.ForeignLib parsec :: CabalParsing m => m LibVersionInfo Source # | |
Parsec FilePathNT # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m FilePathNT Source # | |
Parsec TestedWith # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m TestedWith Source # | |
Parsec SpecLicense # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m SpecLicense Source # | |
Parsec SpecVersion # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m SpecVersion Source # | |
Parsec Token' # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m Token' Source # | |
Parsec Token # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m Token Source # | |
Parsec TestShowDetails # | |
Defined in Distribution.Simple.Setup parsec :: CabalParsing m => m TestShowDetails Source # | |
Parsec HaddockTarget # | |
Defined in Distribution.Simple.Setup parsec :: CabalParsing m => m HaddockTarget Source # | |
Parsec a => Parsec (Identity a) # | |
Defined in Distribution.Parsec parsec :: CabalParsing m => m (Identity a) Source # | |
Parsec a => Parsec (MQuoted a) # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m (MQuoted a) Source # | |
(Newtype a b, Ord a, Sep sep, Parsec b) => Parsec (Set' sep b a) # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m (Set' sep b a) Source # | |
(Newtype a b, Sep sep, Parsec b) => Parsec (List sep b a) # | |
Defined in Distribution.Parsec.Newtypes parsec :: CabalParsing m => m (List sep b a) Source # |
newtype ParsecParser a Source #
PP | |
|
Instances
runParsecParser :: ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a Source #
Run ParsecParser
with cabalSpecLatest
.
runParsecParser' :: CabalSpecVersion -> ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a Source #
Like runParsecParser
but lets specify CabalSpecVersion
used.
Since: Cabal-3.0.0.0
simpleParsec :: Parsec a => String -> Maybe a Source #
Parse a String
with lexemeParsec
.
lexemeParsec :: (CabalParsing m, Parsec a) => m a Source #
parsec
could consume trailing spaces, this function will consume.
eitherParsec :: Parsec a => String -> Either String a Source #
Parse a String
with lexemeParsec
.
explicitEitherParsec :: ParsecParser a -> String -> Either String a Source #
Parse a String
with given ParsecParser
. Trailing whitespace is accepted.
CabalParsing and and diagnostics
class (CharParsing m, MonadPlus m, MonadFail m) => CabalParsing m where Source #
Parsing class which
- can report Cabal parser warnings.
- knows
cabal-version
we work with
parsecWarning :: PWarnType -> String -> m () Source #
parsecHaskellString :: m String Source #
Instances
Warnings
Type of parser warning. We do classify warnings.
Different application may decide not to show some, or have fatal behaviour on others
PWTOther | Unclassified warning |
PWTUTF | Invalid UTF encoding |
PWTBoolCase |
|
PWTVersionTag | there are version with tags |
PWTNewSyntax | New syntax used, but no |
PWTOldSyntax | Old syntax used, and |
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. |
Instances
Parser warning.
Instances
Show PWarning # | |
Generic PWarning # | |
Binary PWarning # | |
NFData PWarning # | |
Defined in Distribution.Parsec.Warning | |
type Rep PWarning # | |
Defined in Distribution.Parsec.Warning type Rep PWarning = D1 ('MetaData "PWarning" "Distribution.Parsec.Warning" "Cabal-3.2.0.0" 'False) (C1 ('MetaCons "PWarning" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 PWarnType) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 Position) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String)))) |
Errors
Parser error.
Instances
Show PError # | |
Generic PError # | |
Binary PError # | |
NFData PError # | |
Defined in Distribution.Parsec.Error | |
type Rep PError # | |
Defined in Distribution.Parsec.Error type Rep PError = D1 ('MetaData "PError" "Distribution.Parsec.Error" "Cabal-3.2.0.0" 'False) (C1 ('MetaCons "PError" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Position) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 String))) |
Position
1-indexed row and column positions in a file.
Instances
Eq Position # | |
Ord Position # | |
Defined in Distribution.Parsec.Position | |
Show Position # | |
Generic Position # | |
Binary Position # | |
NFData Position # | |
Defined in Distribution.Parsec.Position | |
type Rep Position # | |
Defined in Distribution.Parsec.Position type Rep Position = D1 ('MetaData "Position" "Distribution.Parsec.Position" "Cabal-3.2.0.0" 'False) (C1 ('MetaCons "Position" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'SourceUnpack 'SourceStrict 'DecidedStrict) (Rec0 Int))) |
Utilities
parsecToken :: CabalParsing m => m String Source #
[^ ,]
parsecToken' :: CabalParsing m => m String Source #
[^ ]
parsecFilePath :: CabalParsing m => m FilePath Source #
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
parsecOptCommaList :: CabalParsing m => m a -> m [a] Source #
parsecLeadingOptCommaList :: CabalParsing m => m a -> m [a] Source #
Like parsecOptCommaList
but
- require all or none commas
- accept leading or trailing comma.
p (comma p)* -- p sepBy
comma
(comma p)* -- leading comma
(p comma)* -- trailing comma
p* -- no commas: many p
Since: Cabal-3.0.0.0
parsecStandard :: (CabalParsing m, Parsec ver) => (ver -> String -> a) -> m a Source #
Parse a benchmark/test-suite types.
parsecUnqualComponentName :: CabalParsing m => m String Source #