Portability | portable |
---|---|
Stability | stable |
Maintainer | Niklas Broberg, d00nibro@chalmers.se |
Language.Haskell.Exts.Pretty
Contents
Description
Pretty printer for Haskell with extensions.
- class Pretty a
- prettyPrintStyleMode :: Pretty a => Style -> PPHsMode -> a -> String
- prettyPrintWithMode :: Pretty a => PPHsMode -> a -> String
- prettyPrint :: Pretty a => a -> String
- data Style = Style {
- mode :: Mode
- lineLength :: Int
- ribbonsPerLine :: Float
- style :: Style
- data Mode
- = PageMode
- | ZigZagMode
- | LeftMode
- | OneLineMode
- data PPHsMode = PPHsMode {
- classIndent :: Indent
- doIndent :: Indent
- caseIndent :: Indent
- letIndent :: Indent
- whereIndent :: Indent
- onsideIndent :: Indent
- spacing :: Bool
- layout :: PPLayout
- linePragmas :: Bool
- type Indent = Int
- data PPLayout
- = PPOffsideRule
- | PPSemiColon
- | PPInLine
- | PPNoLayout
- defaultMode :: PPHsMode
Pretty printing
Things that can be pretty-printed, including all the syntactic objects in Language.Haskell.Exts.Syntax and Language.Haskell.Exts.Annotated.Syntax.
Instances
prettyPrintStyleMode :: Pretty a => Style -> PPHsMode -> a -> StringSource
pretty-print with a given style and mode.
prettyPrintWithMode :: Pretty a => PPHsMode -> a -> StringSource
pretty-print with the default style and a given mode.
prettyPrint :: Pretty a => a -> StringSource
pretty-print with the default style and defaultMode
.
Pretty-printing styles (from Text.PrettyPrint.HughesPJ)
data Style
A rendering style.
Constructors
Style | |
Fields
|
data Mode
Rendering mode.
Constructors
PageMode | Normal |
ZigZagMode | With zig-zag cuts |
LeftMode | No indentation, infinitely long lines |
OneLineMode | All on one line |
Haskell formatting modes
Pretty-printing parameters.
Note: the onsideIndent
must be positive and less than all other indents.
Constructors
PPHsMode | |
Fields
|
Varieties of layout we can use.
Constructors
PPOffsideRule | classical layout |
PPSemiColon | classical layout made explicit |
PPInLine | inline decls, with newlines between them |
PPNoLayout | everything on a single line |
The default mode: pretty-print using the offside rule and sensible defaults.