Distribution.Parsec

Cabal-3.0.1.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Parsec

Contents

- CabalParsing and and diagnostics
  - Warnings
  - Errors
- Position
- Utilities

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 Parsec a where Source #

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

For parsing `.cabal` like file structure, see Distribution.Fields.

Methods

parsec :: CabalParsing m => m a Source #

#### Instances

Instances details

Parsec Bool # |
Instance details Defined in Distribution.Parsec Methods parsec :: CabalParsing m => m Bool Source #
Parsec Version # |
Instance details Defined in Distribution.Types.Version Methods parsec :: CabalParsing m => m Version Source #
Parsec VersionRange # |
Instance details Defined in Distribution.Types.VersionRange.Internal Methods parsec :: CabalParsing m => m VersionRange Source #
Parsec RepoType # |
Instance details Defined in Distribution.Types.SourceRepo Methods parsec :: CabalParsing m => m RepoType Source #
Parsec RepoKind # |
Instance details Defined in Distribution.Types.SourceRepo Methods parsec :: CabalParsing m => m RepoKind Source #
Parsec PkgconfigVersion # |
Instance details Defined in Distribution.Types.PkgconfigVersion Methods parsec :: CabalParsing m => m PkgconfigVersion Source #
Parsec PkgconfigVersionRange # |
Instance details Defined in Distribution.Types.PkgconfigVersionRange Methods parsec :: CabalParsing m => m PkgconfigVersionRange Source #
Parsec PkgconfigName # |
Instance details Defined in Distribution.Types.PkgconfigName Methods parsec :: CabalParsing m => m PkgconfigName Source #
Parsec PkgconfigDependency # |
Instance details Defined in Distribution.Types.PkgconfigDependency Methods parsec :: CabalParsing m => m PkgconfigDependency Source #
Parsec PackageName # |
Instance details Defined in Distribution.Types.PackageName Methods parsec :: CabalParsing m => m PackageName Source #
Parsec UnqualComponentName # |
Instance details Defined in Distribution.Types.UnqualComponentName Methods parsec :: CabalParsing m => m UnqualComponentName Source #
Parsec PackageVersionConstraint # |
Instance details Defined in Distribution.Types.PackageVersionConstraint Methods parsec :: CabalParsing m => m PackageVersionConstraint Source #
Parsec LibraryVisibility # |
Instance details Defined in Distribution.Types.LibraryVisibility Methods parsec :: CabalParsing m => m LibraryVisibility Source #
Parsec MungedPackageName # |
    >>> simpleParsec "servant" :: Maybe MungedPackageName
    Just (MungedPackageName (PackageName "servant") LMainLibName)
    >>> simpleParsec "z-servant-z-lackey" :: Maybe MungedPackageName
    Just (MungedPackageName (PackageName "servant") (LSubLibName (UnqualComponentName "lackey")))
    >>> simpleParsec "z-servant-zz" :: Maybe MungedPackageName
    Just (MungedPackageName (PackageName "z-servant-zz") LMainLibName)
Instance details Defined in Distribution.Types.MungedPackageName Methods parsec :: CabalParsing m => m MungedPackageName Source #
Parsec ForeignLibType # |
Instance details Defined in Distribution.Types.ForeignLibType Methods parsec :: CabalParsing m => m ForeignLibType Source #
Parsec ForeignLibOption # |
Instance details Defined in Distribution.Types.ForeignLibOption Methods parsec :: CabalParsing m => m ForeignLibOption Source #
Parsec ExecutableScope # |
Instance details Defined in Distribution.Types.ExecutableScope Methods parsec :: CabalParsing m => m ExecutableScope Source #
Parsec ComponentName # |
Instance details Defined in Distribution.Types.ComponentName Methods parsec :: CabalParsing m => m ComponentName Source #
Parsec ComponentId # |
Instance details Defined in Distribution.Types.ComponentId Methods parsec :: CabalParsing m => m ComponentId Source #
Parsec BuildType # |
Instance details Defined in Distribution.Types.BuildType Methods parsec :: CabalParsing m => m BuildType Source #
Parsec AbiHash # |
Instance details Defined in Distribution.Types.AbiHash Methods parsec :: CabalParsing m => m AbiHash Source #
Parsec Platform # |
Instance details Defined in Distribution.System Methods parsec :: CabalParsing m => m Platform Source #
Parsec Arch # |
Instance details Defined in Distribution.System Methods parsec :: CabalParsing m => m Arch Source #
Parsec OS # |
Instance details Defined in Distribution.System Methods parsec :: CabalParsing m => m OS Source #
Parsec LicenseRef # |
Instance details Defined in Distribution.SPDX.LicenseReference Methods parsec :: CabalParsing m => m LicenseRef Source #
Parsec LicenseId # |
    >>> 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?"
Instance details Defined in Distribution.SPDX.LicenseId Methods parsec :: CabalParsing m => m LicenseId Source #
Parsec LicenseExceptionId # |
Instance details Defined in Distribution.SPDX.LicenseExceptionId Methods parsec :: CabalParsing m => m LicenseExceptionId Source #
Parsec SimpleLicenseExpression # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods parsec :: CabalParsing m => m SimpleLicenseExpression Source #
Parsec LicenseExpression # |
Instance details Defined in Distribution.SPDX.LicenseExpression Methods parsec :: CabalParsing m => m LicenseExpression Source #
Parsec License # |
    >>> 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
Instance details Defined in Distribution.SPDX.License Methods parsec :: CabalParsing m => m License Source #
Parsec ModuleName # |
Instance details Defined in Distribution.ModuleName Methods parsec :: CabalParsing m => m ModuleName Source #
Parsec ModuleRenaming # |
Instance details Defined in Distribution.Types.ModuleRenaming Methods parsec :: CabalParsing m => m ModuleRenaming Source #
Parsec IncludeRenaming # |
Instance details Defined in Distribution.Types.IncludeRenaming Methods parsec :: CabalParsing m => m IncludeRenaming Source #
Parsec Mixin # |
Instance details Defined in Distribution.Types.Mixin Methods parsec :: CabalParsing m => m Mixin Source #
Parsec ModuleReexport # |
Instance details Defined in Distribution.Types.ModuleReexport Methods parsec :: CabalParsing m => m ModuleReexport Source #
Parsec TestType # |
Instance details Defined in Distribution.Types.TestType Methods parsec :: CabalParsing m => m TestType Source #
Parsec PackageIdentifier # |
    >>> simpleParsec "foo-bar-0" :: Maybe PackageIdentifier
    Just (PackageIdentifier {pkgName = PackageName "foo-bar", pkgVersion = mkVersion [0]})
    >>> simpleParsec "foo-bar" :: Maybe PackageIdentifier
    Just (PackageIdentifier {pkgName = PackageName "foo-bar", pkgVersion = mkVersion []})
Note: Stricter than `Text` instance
    >>> simpleParsec "foo-bar-0-0" :: Maybe PackageIdentifier
    Nothing
    >>> simpleParsec "foo-bar.0" :: Maybe PackageIdentifier
    Nothing
    >>> simpleParsec "foo-bar.4-2" :: Maybe PackageIdentifier
    Nothing
    >>> simpleParsec "1.2.3" :: Maybe PackageIdentifier
    Nothing
Instance details Defined in Distribution.Types.PackageId Methods parsec :: CabalParsing m => m PackageIdentifier Source #
Parsec DefUnitId # |
Instance details Defined in Distribution.Types.UnitId Methods parsec :: CabalParsing m => m DefUnitId Source #
Parsec UnitId # | The textual format for `UnitId` coincides with the format GHC accepts for `-package-id`.
Instance details Defined in Distribution.Types.UnitId Methods parsec :: CabalParsing m => m UnitId Source #
Parsec Module # |
Instance details Defined in Distribution.Types.Module 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 Defined in Distribution.Backpack Methods parsec :: CabalParsing m => m OpenModule Source #
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 Defined in Distribution.Backpack Methods parsec :: CabalParsing m => m OpenUnitId Source #
Parsec ExposedModule # |
Instance details Defined in Distribution.Types.ExposedModule Methods parsec :: CabalParsing m => m ExposedModule Source #
Parsec MungedPackageId # |
    >>> simpleParsec "foo-bar-0" :: Maybe MungedPackageId
    Just (MungedPackageId {mungedName = MungedPackageName (PackageName "foo-bar") LMainLibName, mungedVersion = mkVersion [0]})
    >>> simpleParsec "foo-bar" :: Maybe MungedPackageId
    Just (MungedPackageId {mungedName = MungedPackageName (PackageName "foo-bar") LMainLibName, mungedVersion = mkVersion []})
    >>> simpleParsec "z-foo-bar-z-baz-0" :: Maybe MungedPackageId
    Just (MungedPackageId {mungedName = MungedPackageName (PackageName "foo-bar") (LSubLibName (UnqualComponentName "baz")), mungedVersion = mkVersion [0]})
    >>> simpleParsec "foo-bar-0-0" :: Maybe MungedPackageId
    Nothing
    >>> simpleParsec "foo-bar.0" :: Maybe MungedPackageId
    Nothing
    >>> simpleParsec "foo-bar.4-2" :: Maybe MungedPackageId
    Nothing
Instance details Defined in Distribution.Types.MungedPackageId Methods parsec :: CabalParsing m => m MungedPackageId Source #
Parsec LegacyExeDependency # |
Instance details Defined in Distribution.Types.LegacyExeDependency Methods parsec :: CabalParsing m => m LegacyExeDependency Source #
Parsec ExeDependency # | Examples
    >>> simpleParsec "happy:happy" :: Maybe ExeDependency
    Just (ExeDependency (PackageName "happy") (UnqualComponentName "happy") AnyVersion)
    >>> simpleParsec "happy:happy >= 1.19.12" :: Maybe ExeDependency
    Just (ExeDependency (PackageName "happy") (UnqualComponentName "happy") (OrLaterVersion (mkVersion [1,19,12])))
    >>> simpleParsec "happy:happy>=1.19.12" :: Maybe ExeDependency
    Just (ExeDependency (PackageName "happy") (UnqualComponentName "happy") (OrLaterVersion (mkVersion [1,19,12])))
    >>> simpleParsec "happy : happy >= 1.19.12" :: Maybe ExeDependency
    Nothing
    >>> simpleParsec "happy: happy >= 1.19.12" :: Maybe ExeDependency
    Nothing
    >>> simpleParsec "happy :happy >= 1.19.12" :: Maybe ExeDependency
    Nothing
Instance details Defined in Distribution.Types.ExeDependency Methods parsec :: CabalParsing m => m ExeDependency Source #
Parsec Dependency # |
Instance details Defined in Distribution.Types.Dependency Methods parsec :: CabalParsing m => m Dependency Source #
Parsec BenchmarkType # |
Instance details Defined in Distribution.Types.BenchmarkType Methods parsec :: CabalParsing m => m BenchmarkType Source #
Parsec AbiDependency # |
Instance details Defined in Distribution.Types.AbiDependency Methods parsec :: CabalParsing m => m AbiDependency Source #
Parsec License # |
Instance details Defined in Distribution.License Methods parsec :: CabalParsing m => m License Source #
Parsec Extension # |
Instance details Defined in Language.Haskell.Extension Methods parsec :: CabalParsing m => m Extension Source #
Parsec Language # |
Instance details Defined in Language.Haskell.Extension Methods parsec :: CabalParsing m => m Language Source #
Parsec AbiTag # |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m AbiTag Source #
Parsec CompilerId # |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m CompilerId Source #
Parsec CompilerFlavor # |
Instance details Defined in Distribution.Compiler Methods parsec :: CabalParsing m => m CompilerFlavor Source #
Parsec LibVersionInfo # |
Instance details Defined in Distribution.Types.ForeignLib Methods parsec :: CabalParsing m => m LibVersionInfo Source #
Parsec FlagName # |
Instance details Defined in Distribution.Types.GenericPackageDescription Methods parsec :: CabalParsing m => m FlagName Source #
Parsec FilePathNT # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m FilePathNT Source #
Parsec TestedWith # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m TestedWith Source #
Parsec SpecLicense # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m SpecLicense Source #
Parsec SpecVersion # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m SpecVersion Source #
Parsec Token' # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m Token' Source #
Parsec Token # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m Token Source #
Parsec TestShowDetails # |
Instance details Defined in Distribution.Simple.Setup Methods parsec :: CabalParsing m => m TestShowDetails Source #
Parsec HaddockTarget # |
Instance details Defined in Distribution.Simple.Setup Methods parsec :: CabalParsing m => m HaddockTarget Source #
Parsec a => Parsec (Identity a) # |
Instance details Defined in Distribution.Parsec Methods parsec :: CabalParsing m => m (Identity a) Source #
Parsec a => Parsec (MQuoted a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m (MQuoted a) Source #
(Newtype a b, Sep sep, Parsec b) => Parsec (List sep b a) # |
Instance details Defined in Distribution.Parsec.Newtypes Methods parsec :: CabalParsing m => m (List sep b a) Source #

newtype ParsecParser a Source #

Constructors

PP |
Fields unPP :: CabalSpecVersion -> Parsec FieldLineStream [PWarning] a

#### Instances

Instances details

Monad ParsecParser # |
Instance details Defined in Distribution.Parsec Methods (>>=) :: ParsecParser a -> (a -> ParsecParser b) -> ParsecParser b Source # (>>) :: ParsecParser a -> ParsecParser b -> ParsecParser b Source # return :: a -> ParsecParser a Source #
Functor ParsecParser # |
Instance details Defined in Distribution.Parsec Methods fmap :: (a -> b) -> ParsecParser a -> ParsecParser b Source # (<$) :: a -> ParsecParser b -> ParsecParser a Source #
MonadFail ParsecParser # |
Instance details Defined in Distribution.Parsec Methods fail :: String -> ParsecParser a Source #
Applicative ParsecParser # |
Instance details Defined in Distribution.Parsec Methods pure :: a -> ParsecParser a Source # (<*>) :: ParsecParser (a -> b) -> ParsecParser a -> ParsecParser b Source # liftA2 :: (a -> b -> c) -> ParsecParser a -> ParsecParser b -> ParsecParser c Source # (*>) :: ParsecParser a -> ParsecParser b -> ParsecParser b Source # (<*) :: ParsecParser a -> ParsecParser b -> ParsecParser a Source #
Alternative ParsecParser # |
Instance details Defined in Distribution.Parsec Methods empty :: ParsecParser a Source # (<|>) :: ParsecParser a -> ParsecParser a -> ParsecParser a Source # some :: ParsecParser a -> ParsecParser [a] Source # many :: ParsecParser a -> ParsecParser [a] Source #
MonadPlus ParsecParser # |
Instance details Defined in Distribution.Parsec Methods mzero :: ParsecParser a Source # mplus :: ParsecParser a -> ParsecParser a -> ParsecParser a Source #
Parsing ParsecParser # |
Instance details Defined in Distribution.Parsec Methods try :: ParsecParser a -> ParsecParser a Source # (<?>) :: ParsecParser a -> String -> ParsecParser a Source # skipMany :: ParsecParser a -> ParsecParser () Source # skipSome :: ParsecParser a -> ParsecParser () Source # unexpected :: String -> ParsecParser a Source # eof :: ParsecParser () Source # notFollowedBy :: Show a => ParsecParser a -> ParsecParser () Source #
CharParsing ParsecParser # |
Instance details Defined in Distribution.Parsec Methods satisfy :: (Char -> Bool) -> ParsecParser Char Source # char :: Char -> ParsecParser Char Source # notChar :: Char -> ParsecParser Char Source # anyChar :: ParsecParser Char Source # string :: String -> ParsecParser String Source # text :: Text -> ParsecParser Text Source #
CabalParsing ParsecParser # |
Instance details Defined in Distribution.Parsec Methods parsecWarning :: PWarnType -> String -> ParsecParser () Source # parsecHaskellString :: ParsecParser String Source # askCabalSpecVersion :: ParsecParser CabalSpecVersion Source #

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

Minimal complete definition

parsecWarning, askCabalSpecVersion

Methods

parsecWarning :: PWarnType -> String -> m () Source #

parsecHaskellString :: m String Source #

askCabalSpecVersion :: m CabalSpecVersion Source #

#### Instances

Instances details

CabalParsing ParsecParser # |
Instance details Defined in Distribution.Parsec Methods parsecWarning :: PWarnType -> String -> ParsecParser () Source # parsecHaskellString :: ParsecParser String Source # askCabalSpecVersion :: ParsecParser CabalSpecVersion Source #

## 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.

#### Instances

Instances details

Bounded PWarnType # |
Instance details Defined in Distribution.Parsec.Warning Methods minBound :: PWarnType Source # maxBound :: PWarnType Source #
Enum PWarnType # |
Instance details Defined in Distribution.Parsec.Warning Methods succ :: PWarnType -> PWarnType Source # pred :: PWarnType -> PWarnType Source # toEnum :: Int -> PWarnType Source # fromEnum :: PWarnType -> Int Source # enumFrom :: PWarnType -> [PWarnType] Source # enumFromThen :: PWarnType -> PWarnType -> [PWarnType] Source # enumFromTo :: PWarnType -> PWarnType -> [PWarnType] Source # enumFromThenTo :: PWarnType -> PWarnType -> PWarnType -> [PWarnType] Source #
Eq PWarnType # |
Instance details Defined in Distribution.Parsec.Warning Methods (==) :: PWarnType -> PWarnType -> Bool # (/=) :: PWarnType -> PWarnType -> Bool #
Ord PWarnType # |
Instance details Defined in Distribution.Parsec.Warning Methods compare :: PWarnType -> PWarnType -> Ordering # (<) :: PWarnType -> PWarnType -> Bool # (<=) :: PWarnType -> PWarnType -> Bool # (>) :: PWarnType -> PWarnType -> Bool # (>=) :: PWarnType -> PWarnType -> Bool # max :: PWarnType -> PWarnType -> PWarnType # min :: PWarnType -> PWarnType -> PWarnType #
Show PWarnType # |
Instance details Defined in Distribution.Parsec.Warning Methods showsPrec :: Int -> PWarnType -> ShowS Source # show :: PWarnType -> String Source # showList :: [PWarnType] -> ShowS Source #
Generic PWarnType # |
Instance details Defined in Distribution.Parsec.Warning Associated Types type Rep PWarnType :: Type -> Type Source # Methods from :: PWarnType -> Rep PWarnType x Source # to :: Rep PWarnType x -> PWarnType Source #
Binary PWarnType # |
Instance details Defined in Distribution.Parsec.Warning Methods put :: PWarnType -> Put Source # get :: Get PWarnType Source # putList :: [PWarnType] -> Put Source #
NFData PWarnType # |
Instance details Defined in Distribution.Parsec.Warning Methods rnf :: PWarnType -> () Source #
type Rep PWarnType # |
Instance details Defined in Distribution.Parsec.Warning type Rep PWarnType = D1 ('MetaData "PWarnType" "Distribution.Parsec.Warning" "Cabal-3.0.1.0" 'False) ((((C1 ('MetaCons "PWTOther" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PWTUTF" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PWTBoolCase" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PWTVersionTag" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PWTNewSyntax" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "PWTOldSyntax" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PWTDeprecatedField" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PWTInvalidSubsection" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PWTUnknownField" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PWTUnknownSection" 'PrefixI 'False) (U1 :: Type -> Type))))) :+: (((C1 ('MetaCons "PWTTrailingFields" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PWTExtraMainIs" 'PrefixI 'False) (U1 :: Type -> Type)) :+: (C1 ('MetaCons "PWTExtraTestModule" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PWTExtraBenchmarkModule" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PWTLexNBSP" 'PrefixI 'False) (U1 :: Type -> Type)))) :+: ((C1 ('MetaCons "PWTLexBOM" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PWTLexTab" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PWTQuirkyCabalFile" 'PrefixI 'False) (U1 :: Type -> Type))) :+: (C1 ('MetaCons "PWTDoubleDash" 'PrefixI 'False) (U1 :: Type -> Type) :+: (C1 ('MetaCons "PWTMultipleSingularField" 'PrefixI 'False) (U1 :: Type -> Type) :+: C1 ('MetaCons "PWTBuildTypeDefault" 'PrefixI 'False) (U1 :: Type -> Type))))))

data PWarning Source #

Parser warning.

Constructors

PWarning !PWarnType !Position String |

#### Instances

Instances details

Show PWarning # |
Instance details Defined in Distribution.Parsec.Warning Methods showsPrec :: Int -> PWarning -> ShowS Source # show :: PWarning -> String Source # showList :: [PWarning] -> ShowS Source #
Generic PWarning # |
Instance details Defined in Distribution.Parsec.Warning Associated Types type Rep PWarning :: Type -> Type Source # Methods from :: PWarning -> Rep PWarning x Source # to :: Rep PWarning x -> PWarning Source #
Binary PWarning # |
Instance details Defined in Distribution.Parsec.Warning Methods put :: PWarning -> Put Source # get :: Get PWarning Source # putList :: [PWarning] -> Put Source #
NFData PWarning # |
Instance details Defined in Distribution.Parsec.Warning Methods rnf :: PWarning -> () Source #
type Rep PWarning # |
Instance details Defined in Distribution.Parsec.Warning type Rep PWarning = D1 ('MetaData "PWarning" "Distribution.Parsec.Warning" "Cabal-3.0.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))))

showPWarning :: FilePath -> PWarning -> String Source #

## Errors

data PError Source #

Parser error.

Constructors

PError Position String |

#### Instances

Instances details

Show PError # |
Instance details Defined in Distribution.Parsec.Error Methods showsPrec :: Int -> PError -> ShowS Source # show :: PError -> String Source # showList :: [PError] -> ShowS Source #
Generic PError # |
Instance details Defined in Distribution.Parsec.Error Associated Types type Rep PError :: Type -> Type Source # Methods from :: PError -> Rep PError x Source # to :: Rep PError x -> PError Source #
Binary PError # |
Instance details Defined in Distribution.Parsec.Error Methods put :: PError -> Put Source # get :: Get PError Source # putList :: [PError] -> Put Source #
NFData PError # |
Instance details Defined in Distribution.Parsec.Error Methods rnf :: PError -> () Source #
type Rep PError # |
Instance details Defined in Distribution.Parsec.Error type Rep PError = D1 ('MetaData "PError" "Distribution.Parsec.Error" "Cabal-3.0.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)))

showPError :: FilePath -> PError -> String Source #

# Position

data Position Source #

1-indexed row and column positions in a file.

Constructors

Position !Int !Int |

#### Instances

Instances details

Eq Position # |
Instance details Defined in Distribution.Parsec.Position Methods (==) :: Position -> Position -> Bool # (/=) :: Position -> Position -> Bool #
Ord Position # |
Instance details Defined in Distribution.Parsec.Position Methods compare :: Position -> Position -> Ordering # (<) :: Position -> Position -> Bool # (<=) :: Position -> Position -> Bool # (>) :: Position -> Position -> Bool # (>=) :: Position -> Position -> Bool # max :: Position -> Position -> Position # min :: Position -> Position -> Position #
Show Position # |
Instance details Defined in Distribution.Parsec.Position Methods showsPrec :: Int -> Position -> ShowS Source # show :: Position -> String Source # showList :: [Position] -> ShowS Source #
Generic Position # |
Instance details Defined in Distribution.Parsec.Position Associated Types type Rep Position :: Type -> Type Source # Methods from :: Position -> Rep Position x Source # to :: Rep Position x -> Position Source #
Binary Position # |
Instance details Defined in Distribution.Parsec.Position Methods put :: Position -> Put Source # get :: Get Position Source # putList :: [Position] -> Put Source #
NFData Position # |
Instance details Defined in Distribution.Parsec.Position Methods rnf :: Position -> () Source #
type Rep Position # |
Instance details Defined in Distribution.Parsec.Position type Rep Position = D1 ('MetaData "Position" "Distribution.Parsec.Position" "Cabal-3.0.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)))

incPos :: Int -> Position -> Position Source #

Shift position by n columns to the right.

retPos :: Position -> Position Source #

Shift position to beginning of next row.

showPos :: Position -> String Source #

zeroPos :: Position Source #

# 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 #