Cabal-syntax
CopyrightIsaac Jones 2003-2005
LicenseBSD3
Maintainercabal-devel@haskell.org
Portabilityportable
Safe HaskellNone
LanguageHaskell2010

Distribution.PackageDescription.Parsec

Description

This defined parsers and partial pretty printers for the .cabal format.

Synopsis

Package descriptions

parseGenericPackageDescription :: ByteString -> ParseResult src GenericPackageDescription Source #

Parses the given file into a GenericPackageDescription.

In Cabal 1.2 the syntax for package descriptions was changed to a format with sections and possibly indented property descriptions.

Parsing

data ParseResult src a Source #

A monad with failure and accumulating errors and warnings.

Instances

Instances details
Applicative (ParseResult src) Source # 
Instance details

Defined in Distribution.Fields.ParseResult

Methods

pure :: a -> ParseResult src a #

(<*>) :: ParseResult src (a -> b) -> ParseResult src a -> ParseResult src b #

liftA2 :: (a -> b -> c) -> ParseResult src a -> ParseResult src b -> ParseResult src c #

(*>) :: ParseResult src a -> ParseResult src b -> ParseResult src b #

(<*) :: ParseResult src a -> ParseResult src b -> ParseResult src a #

Functor (ParseResult src) Source # 
Instance details

Defined in Distribution.Fields.ParseResult

Methods

fmap :: (a -> b) -> ParseResult src a -> ParseResult src b #

(<$) :: a -> ParseResult src b -> ParseResult src a #

Monad (ParseResult src) Source # 
Instance details

Defined in Distribution.Fields.ParseResult

Methods

(>>=) :: ParseResult src a -> (a -> ParseResult src b) -> ParseResult src b #

(>>) :: ParseResult src a -> ParseResult src b -> ParseResult src b #

return :: a -> ParseResult src a #

runParseResult :: ParseResult src a -> ([PWarningWithSource src], Either (Maybe Version, NonEmpty (PErrorWithSource src)) a) Source #

Destruct a ParseResult into the emitted warnings and either a successful value or list of errors and possibly recovered a spec-version declaration.

data PSource src Source #

The source of a parse error

Constructors

PKnownSource src 
PUnknownSource 

Instances

Instances details
Functor PSource Source # 
Instance details

Defined in Distribution.Parsec.Source

Methods

fmap :: (a -> b) -> PSource a -> PSource b #

(<$) :: a -> PSource b -> PSource a #

Binary src => Binary (PSource src) Source # 
Instance details

Defined in Distribution.Parsec.Source

Methods

put :: PSource src -> Put #

get :: Get (PSource src) #

putList :: [PSource src] -> Put #

NFData src => NFData (PSource src) Source # 
Instance details

Defined in Distribution.Parsec.Source

Methods

rnf :: PSource src -> () #

Generic (PSource src) Source # 
Instance details

Defined in Distribution.Parsec.Source

Associated Types

type Rep (PSource src) 
Instance details

Defined in Distribution.Parsec.Source

type Rep (PSource src) = D1 ('MetaData "PSource" "Distribution.Parsec.Source" "Cabal-syntax-3.18.1.0-inplace" 'False) (C1 ('MetaCons "PKnownSource" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 src)) :+: C1 ('MetaCons "PUnknownSource" 'PrefixI 'False) (U1 :: Type -> Type))

Methods

from :: PSource src -> Rep (PSource src) x #

to :: Rep (PSource src) x -> PSource src #

Show src => Show (PSource src) Source # 
Instance details

Defined in Distribution.Parsec.Source

Methods

showsPrec :: Int -> PSource src -> ShowS #

show :: PSource src -> String #

showList :: [PSource src] -> ShowS #

Eq src => Eq (PSource src) Source # 
Instance details

Defined in Distribution.Parsec.Source

Methods

(==) :: PSource src -> PSource src -> Bool #

(/=) :: PSource src -> PSource src -> Bool #

Ord src => Ord (PSource src) Source # 
Instance details

Defined in Distribution.Parsec.Source

Methods

compare :: PSource src -> PSource src -> Ordering #

(<) :: PSource src -> PSource src -> Bool #

(<=) :: PSource src -> PSource src -> Bool #

(>) :: PSource src -> PSource src -> Bool #

(>=) :: PSource src -> PSource src -> Bool #

max :: PSource src -> PSource src -> PSource src #

min :: PSource src -> PSource src -> PSource src #

type Rep (PSource src) Source # 
Instance details

Defined in Distribution.Parsec.Source

type Rep (PSource src) = D1 ('MetaData "PSource" "Distribution.Parsec.Source" "Cabal-syntax-3.18.1.0-inplace" 'False) (C1 ('MetaCons "PKnownSource" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 src)) :+: C1 ('MetaCons "PUnknownSource" 'PrefixI 'False) (U1 :: Type -> Type))

withSource :: src -> ParseResult src a -> ParseResult src a Source #

New-style spec-version

scanSpecVersion :: ByteString -> Maybe Version Source #

Quickly scan new-style spec-version

A new-style spec-version declaration begins the .cabal file and follow the following case-insensitive grammar (expressed in RFC5234 ABNF):

newstyle-spec-version-decl = "cabal-version" *WS ":" *WS newstyle-spec-version *WS

spec-version               = NUM "." NUM [ "." NUM ]

NUM    = DIGIT0 / DIGITP 1*DIGIT0
DIGIT0 = %x30-39
DIGITP = %x31-39
WS = %20

Supplementary build information