Safe Haskell | Safe-Inferred |
---|---|
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
- simpleParsecBS :: Parsec a => ByteString -> Maybe a
- simpleParsec' :: Parsec a => CabalSpecVersion -> String -> Maybe a
- simpleParsecW' :: Parsec a => CabalSpecVersion -> String -> Maybe a
- lexemeParsec :: (CabalParsing m, Parsec a) => m a
- eitherParsec :: Parsec a => String -> Either String a
- explicitEitherParsec :: ParsecParser a -> String -> Either String a
- explicitEitherParsec' :: CabalSpecVersion -> 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
- | PWTVersionOperator
- | PWTVersionWildcard
- | PWTSpecVersion
- | PWTEmptyFilePath
- | PWTExperimental
- 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]
- parsecCommaNonEmpty :: CabalParsing m => m a -> m (NonEmpty a)
- parsecLeadingCommaList :: CabalParsing m => m a -> m [a]
- parsecLeadingCommaNonEmpty :: CabalParsing m => m a -> m (NonEmpty 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 :: forall m. 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 OpenModule Source # |
|
Defined in Distribution.Backpack parsec :: CabalParsing m => m OpenModule Source # | |
Parsec OpenUnitId Source # |
|
Defined in Distribution.Backpack parsec :: CabalParsing m => m OpenUnitId Source # | |
Parsec AbiTag Source # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m AbiTag Source # | |
Parsec CompilerFlavor Source # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m CompilerFlavor Source # | |
Parsec CompilerId Source # | |
Defined in Distribution.Compiler parsec :: CabalParsing m => m CompilerId Source # | |
Parsec FilePathNT Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m FilePathNT Source # | |
Parsec SpecLicense Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m SpecLicense Source # | |
Parsec SpecVersion Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m SpecVersion Source # | |
Parsec TestedWith Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m TestedWith Source # | |
Parsec Token Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m Token Source # | |
Parsec Token' Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m Token' Source # | |
Parsec License Source # | |
Defined in Distribution.License parsec :: CabalParsing m => m License Source # | |
Parsec ModuleName Source # | |
Defined in Distribution.ModuleName parsec :: CabalParsing m => m ModuleName Source # | |
Parsec License Source # |
|
Defined in Distribution.SPDX.License parsec :: CabalParsing m => m License Source # | |
Parsec LicenseExceptionId Source # | |
Defined in Distribution.SPDX.LicenseExceptionId parsec :: CabalParsing m => m LicenseExceptionId Source # | |
Parsec LicenseExpression Source # | |
Defined in Distribution.SPDX.LicenseExpression parsec :: CabalParsing m => m LicenseExpression Source # | |
Parsec SimpleLicenseExpression Source # | |
Defined in Distribution.SPDX.LicenseExpression parsec :: CabalParsing m => m SimpleLicenseExpression Source # | |
Parsec LicenseId Source # |
|
Defined in Distribution.SPDX.LicenseId parsec :: CabalParsing m => m LicenseId Source # | |
Parsec LicenseRef Source # | |
Defined in Distribution.SPDX.LicenseReference parsec :: CabalParsing m => m LicenseRef Source # | |
Parsec Arch Source # | |
Defined in Distribution.System parsec :: CabalParsing m => m Arch Source # | |
Parsec OS Source # | |
Defined in Distribution.System parsec :: CabalParsing m => m OS Source # | |
Parsec Platform Source # | |
Defined in Distribution.System parsec :: CabalParsing m => m Platform Source # | |
Parsec AbiDependency Source # | |
Defined in Distribution.Types.AbiDependency parsec :: CabalParsing m => m AbiDependency Source # | |
Parsec AbiHash Source # | |
Defined in Distribution.Types.AbiHash parsec :: CabalParsing m => m AbiHash Source # | |
Parsec BenchmarkType Source # | |
Defined in Distribution.Types.BenchmarkType parsec :: CabalParsing m => m BenchmarkType Source # | |
Parsec BuildType Source # | |
Defined in Distribution.Types.BuildType parsec :: CabalParsing m => m BuildType Source # | |
Parsec ComponentId Source # | |
Defined in Distribution.Types.ComponentId parsec :: CabalParsing m => m ComponentId Source # | |
Parsec ComponentName Source # | |
Defined in Distribution.Types.ComponentName parsec :: CabalParsing m => m ComponentName Source # | |
Parsec Dependency Source # |
Spaces around colon are not allowed:
Sublibrary syntax is accepted since
|
Defined in Distribution.Types.Dependency parsec :: CabalParsing m => m Dependency Source # | |
Parsec ExeDependency Source # | Examples
|
Defined in Distribution.Types.ExeDependency parsec :: CabalParsing m => m ExeDependency Source # | |
Parsec ExecutableScope Source # | |
Defined in Distribution.Types.ExecutableScope parsec :: CabalParsing m => m ExecutableScope Source # | |
Parsec ExposedModule Source # | |
Defined in Distribution.Types.ExposedModule parsec :: CabalParsing m => m ExposedModule Source # | |
Parsec FlagAssignment Source # |
Issue #7279 was fixed in Cabal-3.8
Since: Cabal-syntax-3.4.0.0 |
Defined in Distribution.Types.Flag parsec :: CabalParsing m => m FlagAssignment Source # | |
Parsec FlagName Source # | |
Defined in Distribution.Types.Flag parsec :: CabalParsing m => m FlagName Source # | |
Parsec LibVersionInfo Source # | |
Defined in Distribution.Types.ForeignLib parsec :: CabalParsing m => m LibVersionInfo Source # | |
Parsec ForeignLibOption Source # | |
Defined in Distribution.Types.ForeignLibOption parsec :: CabalParsing m => m ForeignLibOption Source # | |
Parsec ForeignLibType Source # | |
Defined in Distribution.Types.ForeignLibType parsec :: CabalParsing m => m ForeignLibType Source # | |
Parsec IncludeRenaming Source # | |
Defined in Distribution.Types.IncludeRenaming parsec :: CabalParsing m => m IncludeRenaming Source # | |
Parsec LegacyExeDependency Source # | |
Defined in Distribution.Types.LegacyExeDependency parsec :: CabalParsing m => m LegacyExeDependency Source # | |
Parsec LibraryVisibility Source # | |
Defined in Distribution.Types.LibraryVisibility parsec :: CabalParsing m => m LibraryVisibility Source # | |
Parsec Mixin Source # |
Sublibrary syntax is accepted since
|
Defined in Distribution.Types.Mixin parsec :: CabalParsing m => m Mixin Source # | |
Parsec Module Source # | |
Defined in Distribution.Types.Module parsec :: CabalParsing m => m Module Source # | |
Parsec ModuleReexport Source # | |
Defined in Distribution.Types.ModuleReexport parsec :: CabalParsing m => m ModuleReexport Source # | |
Parsec ModuleRenaming Source # | |
Defined in Distribution.Types.ModuleRenaming parsec :: CabalParsing m => m ModuleRenaming Source # | |
Parsec MungedPackageId Source # |
|
Defined in Distribution.Types.MungedPackageId parsec :: CabalParsing m => m MungedPackageId Source # | |
Parsec MungedPackageName Source # |
|
Defined in Distribution.Types.MungedPackageName parsec :: CabalParsing m => m MungedPackageName Source # | |
Parsec PackageIdentifier Source # |
Note: Stricter than
|
Defined in Distribution.Types.PackageId parsec :: CabalParsing m => m PackageIdentifier Source # | |
Parsec PackageName Source # | |
Defined in Distribution.Types.PackageName parsec :: CabalParsing m => m PackageName Source # | |
Parsec PackageVersionConstraint Source # |
|
Defined in Distribution.Types.PackageVersionConstraint parsec :: CabalParsing m => m PackageVersionConstraint Source # | |
Parsec PkgconfigDependency Source # | |
Defined in Distribution.Types.PkgconfigDependency parsec :: CabalParsing m => m PkgconfigDependency Source # | |
Parsec PkgconfigName Source # | |
Defined in Distribution.Types.PkgconfigName parsec :: CabalParsing m => m PkgconfigName Source # | |
Parsec PkgconfigVersion Source # |
|
Defined in Distribution.Types.PkgconfigVersion parsec :: CabalParsing m => m PkgconfigVersion Source # | |
Parsec PkgconfigVersionRange Source # | |
Defined in Distribution.Types.PkgconfigVersionRange parsec :: CabalParsing m => m PkgconfigVersionRange Source # | |
Parsec KnownRepoType Source # | |
Defined in Distribution.Types.SourceRepo parsec :: CabalParsing m => m KnownRepoType Source # | |
Parsec RepoKind Source # | |
Defined in Distribution.Types.SourceRepo parsec :: CabalParsing m => m RepoKind Source # | |
Parsec RepoType Source # | |
Defined in Distribution.Types.SourceRepo parsec :: CabalParsing m => m RepoType Source # | |
Parsec TestType Source # | |
Defined in Distribution.Types.TestType parsec :: CabalParsing m => m TestType Source # | |
Parsec DefUnitId Source # | |
Defined in Distribution.Types.UnitId parsec :: CabalParsing m => m DefUnitId Source # | |
Parsec UnitId Source # | The textual format for |
Defined in Distribution.Types.UnitId parsec :: CabalParsing m => m UnitId Source # | |
Parsec UnqualComponentName Source # | |
Defined in Distribution.Types.UnqualComponentName parsec :: CabalParsing m => m UnqualComponentName Source # | |
Parsec Version Source # | |
Defined in Distribution.Types.Version parsec :: CabalParsing m => m Version Source # | |
Parsec VersionRange Source # |
Small history:
Set operations are introduced in 3.0
Operators are introduced in 1.8. Issues only a warning.
Wild-version ranges are introduced in 1.6. Issues only a warning.
|
Defined in Distribution.Types.VersionRange.Internal parsec :: CabalParsing m => m VersionRange Source # | |
Parsec Extension Source # | |
Defined in Language.Haskell.Extension parsec :: CabalParsing m => m Extension Source # | |
Parsec Language Source # | |
Defined in Language.Haskell.Extension parsec :: CabalParsing m => m Language Source # | |
Parsec Bool Source # | |
Defined in Distribution.Parsec parsec :: CabalParsing m => m Bool Source # | |
FieldGrammar Parsec ParsecFieldGrammar Source # | |
Defined in Distribution.FieldGrammar.Parsec blurFieldGrammar :: ALens' a b -> ParsecFieldGrammar b d -> ParsecFieldGrammar a d Source # uniqueFieldAla :: (Parsec b, Newtype a b) => FieldName -> (a -> b) -> ALens' s a -> ParsecFieldGrammar s a Source # booleanFieldDef :: FieldName -> ALens' s Bool -> Bool -> ParsecFieldGrammar s Bool Source # optionalFieldAla :: (Parsec b, Newtype a b) => FieldName -> (a -> b) -> ALens' s (Maybe a) -> ParsecFieldGrammar s (Maybe a) Source # optionalFieldDefAla :: (Parsec b, Newtype a b, Eq a) => FieldName -> (a -> b) -> ALens' s a -> a -> ParsecFieldGrammar s a Source # freeTextField :: FieldName -> ALens' s (Maybe String) -> ParsecFieldGrammar s (Maybe String) Source # freeTextFieldDef :: FieldName -> ALens' s String -> ParsecFieldGrammar s String Source # freeTextFieldDefST :: FieldName -> ALens' s ShortText -> ParsecFieldGrammar s ShortText Source # monoidalFieldAla :: (Parsec b, Monoid a, Newtype a b) => FieldName -> (a -> b) -> ALens' s a -> ParsecFieldGrammar s a Source # prefixedFields :: FieldName -> ALens' s [(String, String)] -> ParsecFieldGrammar s [(String, String)] Source # knownField :: FieldName -> ParsecFieldGrammar s () Source # hiddenField :: ParsecFieldGrammar s a -> ParsecFieldGrammar s a Source # deprecatedSince :: CabalSpecVersion -> String -> ParsecFieldGrammar s a -> ParsecFieldGrammar s a Source # removedIn :: CabalSpecVersion -> String -> ParsecFieldGrammar s a -> ParsecFieldGrammar s a Source # availableSince :: CabalSpecVersion -> a -> ParsecFieldGrammar s a -> ParsecFieldGrammar s a Source # availableSinceWarn :: CabalSpecVersion -> ParsecFieldGrammar s a -> ParsecFieldGrammar s a Source # | |
Parsec a => Parsec (MQuoted a) Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m (MQuoted a) Source # | |
Parsec a => Parsec (Identity a) Source # | |
Defined in Distribution.Parsec parsec :: CabalParsing m => m (Identity a) Source # | |
Parsec (SymbolicPath from to) Source # | |
Defined in Distribution.Utils.Path parsec :: CabalParsing m => m (SymbolicPath from to) Source # | |
(Newtype a b, Sep sep, Parsec b) => Parsec (List sep b a) Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m (List sep b a) Source # | |
(Newtype a b, Sep sep, Parsec b) => Parsec (NonEmpty' sep b a) Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m (NonEmpty' sep b a) Source # | |
(Newtype a b, Ord a, Sep sep, Parsec b) => Parsec (Set' sep b a) Source # | |
Defined in Distribution.FieldGrammar.Newtypes parsec :: CabalParsing m => m (Set' 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-syntax-3.0.0.0
simpleParsec :: Parsec a => String -> Maybe a Source #
Parse a String
with lexemeParsec
.
simpleParsecBS :: Parsec a => ByteString -> Maybe a Source #
Like simpleParsec
but for ByteString
simpleParsec' :: Parsec a => CabalSpecVersion -> String -> Maybe a Source #
Parse a String
with lexemeParsec
using specific CabalSpecVersion
.
Since: Cabal-syntax-3.4.0.0
simpleParsecW' :: Parsec a => CabalSpecVersion -> String -> Maybe a Source #
Parse a String
with lexemeParsec
using specific CabalSpecVersion
.
Fail if there are any warnings.
Since: Cabal-syntax-3.4.0.0
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.
explicitEitherParsec' :: CabalSpecVersion -> ParsecParser a -> String -> Either String a Source #
Parse a String
with given ParsecParser
and CabalSpecVersion
. Trailing whitespace is accepted.
See explicitEitherParsec
.
Since: Cabal-syntax-3.4.0.0
CabalParsing 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. |
PWTVersionOperator | Version operators used (without cabal-version: 1.8) |
PWTVersionWildcard | Version wildcard used (without cabal-version: 1.6) |
PWTSpecVersion | Warnings about cabal-version format. |
PWTEmptyFilePath | Empty filepath, i.e. literally "" |
PWTExperimental | Experimental feature |
Instances
Parser warning.
Instances
Generic PWarning Source # | |
Show PWarning Source # | |
Binary PWarning Source # | |
NFData PWarning Source # | |
Defined in Distribution.Parsec.Warning | |
type Rep PWarning Source # | |
Defined in Distribution.Parsec.Warning type Rep PWarning = D1 ('MetaData "PWarning" "Distribution.Parsec.Warning" "Cabal-syntax-3.8.1.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
Generic PError Source # | |
Show PError Source # | |
Binary PError Source # | |
NFData PError Source # | |
Defined in Distribution.Parsec.Error | |
type Rep PError Source # | |
Defined in Distribution.Parsec.Error type Rep PError = D1 ('MetaData "PError" "Distribution.Parsec.Error" "Cabal-syntax-3.8.1.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
Generic Position Source # | |
Show Position Source # | |
Binary Position Source # | |
NFData Position Source # | |
Defined in Distribution.Parsec.Position | |
Eq Position Source # | |
Ord Position Source # | |
Defined in Distribution.Parsec.Position | |
type Rep Position Source # | |
Defined in Distribution.Parsec.Position type Rep Position = D1 ('MetaData "Position" "Distribution.Parsec.Position" "Cabal-syntax-3.8.1.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 #
parsecCommaNonEmpty :: CabalParsing m => m a -> m (NonEmpty 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
parsecLeadingCommaNonEmpty :: CabalParsing m => m a -> m (NonEmpty a) Source #
Since: Cabal-syntax-3.4.0.0
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-syntax-3.0.0.0
parsecStandard :: (CabalParsing m, Parsec ver) => (ver -> String -> a) -> m a Source #
Parse a benchmark/test-suite types.
parsecUnqualComponentName :: forall m. CabalParsing m => m String Source #