This type is used to discern when a comment block should go
before or after a cabal-like file field, otherwise it would
be hardcoded to a single position. It is often used in
conjunction with PrettyField.
ModuleCabal-syntax-3.12.1.0Haskell2010
Distribution.Fields.Pretty
Cabal-like file AST types: Field, Section etc,
This (intermediate) data type is used for pretty-printing.
- 2 types
- 6 values
- PackageCabal-syntax-3.12.1.0
- Exports8
- LanguageHaskell2010
- LicenceBSD-3-Clause
- SourcePretty.hs
Fields
4 declarationsConstructors
PrettyField ann FieldName DocPrettySection ann FieldName [Doc] [PrettyField ann]PrettyEmpty
Instances3Functor, Foldable, Traversable
Functor PrettyFieldDefined in Cabal-syntax-3.12.1.0 · Distribution.Fields.PrettyFoldable PrettyFieldDefined in Cabal-syntax-3.12.1.0 · Distribution.Fields.PrettyTraversable PrettyFieldDefined in Cabal-syntax-3.12.1.0 · Distribution.Fields.Pretty
Prettyprint a list of fields.
Note: the first argument should return Strings without newlines
and properly prefixes (with --) to count as comments.
This unsafety is left in place so one could generate empty lines
between comment lines.
showFields' :: (ann -> CommentPosition)Convert an annotation to lined to precede the field or section.
-> (ann -> [String] -> [String])Post-process non-annotation produced lines.
-> IntIndentation level.
-> [PrettyField ann]Fields/sections to show.
-> String
showFields with user specified indentation.
Transformation from Field
4 declarationsSimple variant of genericFromParsecField
genericFromParsecFields :: Applicative f=> (FieldName -> [FieldLine ann] -> f Doc)transform field contents
-> (FieldName -> [SectionArg ann] -> f [Doc])transform section arguments
-> [Field ann]-> f [PrettyField ann]
Used in fromParsecFields.
Used in fromParsecFields.