Distribution.Parsec.Common

Cabal-2.4.0.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Parsec.Common

Contents

- Diagnostics
- Position

Description

Module containing small types

Synopsis

- data PError = PError Position String
- showPError :: FilePath -> PError -> String
- data PWarning = PWarning !PWarnType !Position String
- data PWarnType
  - = PWTOther
  - | PWTUTF
  - | PWTBoolCase
  - | PWTVersionTag
  - | PWTNewSyntax
  - | PWTOldSyntax
  - | PWTDeprecatedField
  - | PWTInvalidSubsection
  - | PWTUnknownField
  - | PWTUnknownSection
  - | PWTTrailingFields
  - | PWTExtraMainIs
  - | PWTExtraTestModule
  - | PWTExtraBenchmarkModule
  - | PWTLexNBSP
  - | PWTLexBOM
  - | PWTLexTab
  - | PWTQuirkyCabalFile
  - | PWTDoubleDash
  - | PWTMultipleSingularField
  - | PWTBuildTypeDefault
  - | PWTVersionLeadingZeros
- showPWarning :: FilePath -> PWarning -> String
- data Position = Position !Int !Int
- incPos :: Int -> Position -> Position
- retPos :: Position -> Position
- showPos :: Position -> String
- zeroPos :: Position

# Diagnostics

data PError Source #

Parser error.

Constructors

PError Position String |

Instances

Show PError # |
Instance details Defined in Distribution.Parsec.Common Methods showsPrec :: Int -> PError -> ShowS Source # show :: PError -> String Source # showList :: [PError] -> ShowS Source #
Generic PError # |
Instance details Defined in Distribution.Parsec.Common 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.Common Methods put :: PError -> Put Source # get :: Get PError Source # putList :: [PError] -> Put Source #
NFData PError # |
Instance details Defined in Distribution.Parsec.Common Methods rnf :: PError -> () Source #
type Rep PError # |
Instance details Defined in Distribution.Parsec.Common type Rep PError = D1 (MetaData "PError" "Distribution.Parsec.Common" "Cabal-2.4.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)))

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

data PWarning Source #

Parser warning.

Constructors

PWarning !PWarnType !Position String |

Instances

Show PWarning # |
Instance details Defined in Distribution.Parsec.Common Methods showsPrec :: Int -> PWarning -> ShowS Source # show :: PWarning -> String Source # showList :: [PWarning] -> ShowS Source #
Generic PWarning # |
Instance details Defined in Distribution.Parsec.Common 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.Common Methods put :: PWarning -> Put Source # get :: Get PWarning Source # putList :: [PWarning] -> Put Source #
NFData PWarning # |
Instance details Defined in Distribution.Parsec.Common Methods rnf :: PWarning -> () Source #
type Rep PWarning # |
Instance details Defined in Distribution.Parsec.Common type Rep PWarning = D1 (MetaData "PWarning" "Distribution.Parsec.Common" "Cabal-2.4.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))))

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.
PWTVersionLeadingZeros | See https://github.com/haskell-infra/hackage-trustees/issues/128

Instances

Bounded PWarnType # |
Instance details Defined in Distribution.Parsec.Common Methods minBound :: PWarnType Source # maxBound :: PWarnType Source #
Enum PWarnType # |
Instance details Defined in Distribution.Parsec.Common 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.Common Methods (==) :: PWarnType -> PWarnType -> Bool # (/=) :: PWarnType -> PWarnType -> Bool #
Ord PWarnType # |
Instance details Defined in Distribution.Parsec.Common 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.Common Methods showsPrec :: Int -> PWarnType -> ShowS Source # show :: PWarnType -> String Source # showList :: [PWarnType] -> ShowS Source #
Generic PWarnType # |
Instance details Defined in Distribution.Parsec.Common 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.Common Methods put :: PWarnType -> Put Source # get :: Get PWarnType Source # putList :: [PWarnType] -> Put Source #
NFData PWarnType # |
Instance details Defined in Distribution.Parsec.Common Methods rnf :: PWarnType -> () Source #
type Rep PWarnType # |
Instance details Defined in Distribution.Parsec.Common type Rep PWarnType = D1 (MetaData "PWarnType" "Distribution.Parsec.Common" "Cabal-2.4.0.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) :+: C1 (MetaCons "PWTVersionLeadingZeros" PrefixI False) (U1 :: Type -> Type))))))

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

# Position

data Position Source #

1-indexed row and column positions in a file.

Constructors

Position !Int !Int |

Instances

Eq Position # |
Instance details Defined in Distribution.Parsec.Common Methods (==) :: Position -> Position -> Bool # (/=) :: Position -> Position -> Bool #
Ord Position # |
Instance details Defined in Distribution.Parsec.Common 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.Common Methods showsPrec :: Int -> Position -> ShowS Source # show :: Position -> String Source # showList :: [Position] -> ShowS Source #
Generic Position # |
Instance details Defined in Distribution.Parsec.Common 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.Common Methods put :: Position -> Put Source # get :: Get Position Source # putList :: [Position] -> Put Source #
NFData Position # |
Instance details Defined in Distribution.Parsec.Common Methods rnf :: Position -> () Source #
type Rep Position # |
Instance details Defined in Distribution.Parsec.Common type Rep Position = D1 (MetaData "Position" "Distribution.Parsec.Common" "Cabal-2.4.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)))

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 #