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
- 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) => 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
- | PWTVersionLeadingZeros
- 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]
- 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.
parsec :: CabalParsing m => m a Source #
Instances
newtype ParsecParser a Source #
PP | |
|
Instances
runParsecParser :: ParsecParser a -> FilePath -> FieldLineStream -> Either ParseError a Source #
Run ParsecParser
with cabalSpecLatest
.
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 & warnings
class (CharParsing m, MonadPlus 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
CabalParsing ParsecParser Source # | |
Defined in Distribution.Parsec.Class | |
t ~ Char => CabalParsing (Parser r t) Source # | |
Defined in Distribution.Parsec.Class |
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. |
PWTVersionLeadingZeros | See https://github.com/haskell-infra/hackage-trustees/issues/128 |
Instances
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 #
parsecStandard :: (CabalParsing m, Parsec ver) => (ver -> String -> a) -> m a Source #
Parse a benchmark/test-suite types.
parsecUnqualComponentName :: CabalParsing m => m String Source #