Cabal-2.2.0.0: A framework for packaging Haskell software

Safe HaskellNone
LanguageHaskell2010

Distribution.Parsec.Field

Contents

Description

Cabal-like file AST types: Field, Section etc

These types are parametrized by an annotation.

Synopsis

Cabal file

data Field ann Source #

A Cabal-like file consists of a series of fields (foo: bar) and sections (library ...).

Constructors

Field !(Name ann) [FieldLine ann] 
Section !(Name ann) [SectionArg ann] [Field ann] 
Instances
Functor Field Source # 
Instance details

Methods

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

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

Eq ann => Eq (Field ann) Source # 
Instance details

Methods

(==) :: Field ann -> Field ann -> Bool #

(/=) :: Field ann -> Field ann -> Bool #

Show ann => Show (Field ann) Source # 
Instance details

Methods

showsPrec :: Int -> Field ann -> ShowS #

show :: Field ann -> String #

showList :: [Field ann] -> ShowS #

fieldName :: Field ann -> Name ann Source #

Section of field name

fieldAnn :: Field ann -> ann Source #

fieldUniverse :: Field ann -> [Field ann] Source #

All transitive descendands of Field, including itself.

Note: the resulting list is never empty.

data FieldLine ann Source #

A line of text representing the value of a field from a Cabal file. A field may contain multiple lines.

Invariant: ByteString has no newlines.

Constructors

FieldLine !ann !ByteString 
Instances
Functor FieldLine Source # 
Instance details

Methods

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

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

Eq ann => Eq (FieldLine ann) Source # 
Instance details

Methods

(==) :: FieldLine ann -> FieldLine ann -> Bool #

(/=) :: FieldLine ann -> FieldLine ann -> Bool #

Show ann => Show (FieldLine ann) Source # 
Instance details

Methods

showsPrec :: Int -> FieldLine ann -> ShowS #

show :: FieldLine ann -> String #

showList :: [FieldLine ann] -> ShowS #

data SectionArg ann Source #

Section arguments, e.g. name of the library

Constructors

SecArgName !ann !ByteString

identifier, or omething which loos like number. Also many dot numbers, i.e. "7.6.3"

SecArgStr !ann !ByteString

quoted string

SecArgOther !ann !ByteString

everything else, mm. operators (e.g. in if-section conditionals)

Instances
Functor SectionArg Source # 
Instance details

Methods

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

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

Eq ann => Eq (SectionArg ann) Source # 
Instance details

Methods

(==) :: SectionArg ann -> SectionArg ann -> Bool #

(/=) :: SectionArg ann -> SectionArg ann -> Bool #

Show ann => Show (SectionArg ann) Source # 
Instance details

Methods

showsPrec :: Int -> SectionArg ann -> ShowS #

show :: SectionArg ann -> String #

showList :: [SectionArg ann] -> ShowS #

sectionArgAnn :: SectionArg ann -> ann Source #

Extract annotation from SectionArg.

Name

data Name ann Source #

A field name.

Invariant: ByteString is lower-case ASCII.

Constructors

Name !ann !FieldName 
Instances
Functor Name Source # 
Instance details

Methods

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

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

Eq ann => Eq (Name ann) Source # 
Instance details

Methods

(==) :: Name ann -> Name ann -> Bool #

(/=) :: Name ann -> Name ann -> Bool #

Show ann => Show (Name ann) Source # 
Instance details

Methods

showsPrec :: Int -> Name ann -> ShowS #

show :: Name ann -> String #

showList :: [Name ann] -> ShowS #

mkName :: ann -> FieldName -> Name ann Source #

nameAnn :: Name ann -> ann Source #