Distribution.Fields.Pretty

Cabal-2.5.0.0: A framework for packaging Haskell software

Safe Haskell | None
Language | Haskell2010

Distribution.Fields.Pretty

Contents

- Fields
- Transformation from `Field`

Description

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

This (intermediate) data type is used for pretty-printing.

Since: Cabal-3.0.0.0

Synopsis

- data PrettyField
  - = PrettyField FieldName Doc
  - | PrettySection FieldName [Doc] [PrettyField]
- showFields :: [PrettyField] -> String
- showFields' :: Int -> [PrettyField] -> String
- fromParsecFields :: [Field ann] -> [PrettyField]
- genericFromParsecFields :: Applicative f => (FieldName -> [FieldLine ann] -> f Doc) -> (FieldName -> [SectionArg ann] -> f [Doc]) -> [Field ann] -> f [PrettyField]
- prettyFieldLines :: FieldName -> [FieldLine ann] -> Doc
- prettySectionArgs :: FieldName -> [SectionArg ann] -> [Doc]

# Fields

data PrettyField Source #

Constructors

PrettyField FieldName Doc |
PrettySection FieldName [Doc] [PrettyField] |

showFields :: [PrettyField] -> String Source #

Prettyprint a list of fields.

showFields' :: Int -> [PrettyField] -> String Source #

`showFields` with user specified indentation.

# Transformation from `Field`

fromParsecFields :: [Field ann] -> [PrettyField] Source #

Simple variant of `genericFromParsecField`

genericFromParsecFields Source #

Arguments

:: Applicative f |
=> (FieldName -> [FieldLine ann] -> f Doc) | transform field contents
-> (FieldName -> [SectionArg ann] -> f [Doc]) | transform section arguments
-> [Field ann] |
-> f [PrettyField] |

prettyFieldLines :: FieldName -> [FieldLine ann] -> Doc Source #

Used in `fromParsecFields`.

prettySectionArgs :: FieldName -> [SectionArg ann] -> [Doc] Source #

Used in `fromParsecFields`.