Distribution.Parsec.Field

Cabal-2.4.0.1: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Parsec.Field

Contents

- Cabal file
- Name

Description

Cabal-like file AST types: `Field`, `Section` etc

These types are parametrized by an annotation.

Synopsis

- data Field ann
  - = Field !(Name ann) [FieldLine ann]
  - | Section !(Name ann) [SectionArg ann] [Field ann]
- fieldName :: Field ann -> Name ann
- fieldAnn :: Field ann -> ann
- fieldUniverse :: Field ann -> [Field ann]
- data FieldLine ann = FieldLine !ann !ByteString
- data SectionArg ann
  - = SecArgName !ann !ByteString
  - | SecArgStr !ann !ByteString
  - | SecArgOther !ann !ByteString
- sectionArgAnn :: SectionArg ann -> ann
- type FieldName = ByteString
- data Name ann = Name !ann !FieldName
- mkName :: ann -> FieldName -> Name ann
- getName :: Name ann -> FieldName
- nameAnn :: Name ann -> ann

# Cabal file

data Field ann #

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 # |
Instance details Defined in Distribution.Parsec.Field Methods fmap :: (a -> b) -> Field a -> Field b Source # (<$) :: a -> Field b -> Field a Source #
Eq ann => Eq (Field ann) # |
Instance details Defined in Distribution.Parsec.Field Methods (==) :: Field ann -> Field ann -> Bool # (/=) :: Field ann -> Field ann -> Bool #
Show ann => Show (Field ann) # |
Instance details Defined in Distribution.Parsec.Field Methods showsPrec :: Int -> Field ann -> ShowS Source # show :: Field ann -> String Source # showList :: [Field ann] -> ShowS Source #

fieldName :: Field ann -> Name ann #

Section of field name

fieldAnn :: Field ann -> ann #

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

All transitive descendands of `Field`, including itself.

Note: the resulting list is never empty.

data FieldLine ann #

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 # |
Instance details Defined in Distribution.Parsec.Field Methods fmap :: (a -> b) -> FieldLine a -> FieldLine b Source # (<$) :: a -> FieldLine b -> FieldLine a Source #
Eq ann => Eq (FieldLine ann) # |
Instance details Defined in Distribution.Parsec.Field Methods (==) :: FieldLine ann -> FieldLine ann -> Bool # (/=) :: FieldLine ann -> FieldLine ann -> Bool #
Show ann => Show (FieldLine ann) # |
Instance details Defined in Distribution.Parsec.Field Methods showsPrec :: Int -> FieldLine ann -> ShowS Source # show :: FieldLine ann -> String Source # showList :: [FieldLine ann] -> ShowS Source #

data SectionArg ann #

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 # |
Instance details Defined in Distribution.Parsec.Field Methods fmap :: (a -> b) -> SectionArg a -> SectionArg b Source # (<$) :: a -> SectionArg b -> SectionArg a Source #
Eq ann => Eq (SectionArg ann) # |
Instance details Defined in Distribution.Parsec.Field Methods (==) :: SectionArg ann -> SectionArg ann -> Bool # (/=) :: SectionArg ann -> SectionArg ann -> Bool #
Show ann => Show (SectionArg ann) # |
Instance details Defined in Distribution.Parsec.Field Methods showsPrec :: Int -> SectionArg ann -> ShowS Source # show :: SectionArg ann -> String Source # showList :: [SectionArg ann] -> ShowS Source #

sectionArgAnn :: SectionArg ann -> ann #

Extract annotation from `SectionArg`.

# Name

type FieldName = ByteString #

data Name ann #

A field name.

Invariant: `ByteString` is lower-case ASCII.

Constructors

Name !ann !FieldName |

Instances

Functor Name # |
Instance details Defined in Distribution.Parsec.Field Methods fmap :: (a -> b) -> Name a -> Name b Source # (<$) :: a -> Name b -> Name a Source #
Eq ann => Eq (Name ann) # |
Instance details Defined in Distribution.Parsec.Field Methods (==) :: Name ann -> Name ann -> Bool # (/=) :: Name ann -> Name ann -> Bool #
Show ann => Show (Name ann) # |
Instance details Defined in Distribution.Parsec.Field Methods showsPrec :: Int -> Name ann -> ShowS Source # show :: Name ann -> String Source # showList :: [Name ann] -> ShowS Source #

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

getName :: Name ann -> FieldName #

nameAnn :: Name ann -> ann #