Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cabal-like file AST types: Field
, Section
etc,
This (intermediate) data type is used for pretty-printing.
Since: 3.0.0.0
Synopsis
- data PrettyField ann
- = PrettyField ann FieldName Doc
- | PrettySection ann FieldName [Doc] [PrettyField ann]
- showFields :: (ann -> [String]) -> [PrettyField ann] -> String
- showFields' :: (ann -> [String]) -> Int -> [PrettyField ann] -> String
- fromParsecFields :: [Field ann] -> [PrettyField ann]
- genericFromParsecFields :: Applicative f => (FieldName -> [FieldLine ann] -> f Doc) -> (FieldName -> [SectionArg ann] -> f [Doc]) -> [Field ann] -> f [PrettyField ann]
- prettyFieldLines :: FieldName -> [FieldLine ann] -> Doc
- prettySectionArgs :: FieldName -> [SectionArg ann] -> [Doc]
Fields
data PrettyField ann #
PrettyField ann FieldName Doc | |
PrettySection ann FieldName [Doc] [PrettyField ann] |
Instances
showFields :: (ann -> [String]) -> [PrettyField ann] -> String #
Prettyprint a list of fields.
Note: the first argument should return String
s 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 -> [String]) -> Int -> [PrettyField ann] -> String #
showFields
with user specified indentation.
Transformation from Field
fromParsecFields :: [Field ann] -> [PrettyField ann] #
Simple variant of genericFromParsecField
:: Applicative f | |
=> (FieldName -> [FieldLine ann] -> f Doc) | transform field contents |
-> (FieldName -> [SectionArg ann] -> f [Doc]) | transform section arguments |
-> [Field ann] | |
-> f [PrettyField ann] |
prettyFieldLines :: FieldName -> [FieldLine ann] -> Doc #
Used in fromParsecFields
.
prettySectionArgs :: FieldName -> [SectionArg ann] -> [Doc] #
Used in fromParsecFields
.