haskell-src-1.0.1.1: Manipulating Haskell source codeContentsIndex
Language.Haskell.Pretty
Portabilityportable
Stabilityexperimental
Maintainerlibraries@haskell.org
Contents
Pretty printing
Pretty-printing styles (from Text.PrettyPrint.HughesPJ)
Haskell formatting modes
Description
Pretty printer for Haskell.
Synopsis
class Pretty a
prettyPrintStyleMode :: Pretty a => Style -> PPHsMode -> a -> String
prettyPrintWithMode :: Pretty a => PPHsMode -> a -> String
prettyPrint :: Pretty a => a -> String
Style
style
Mode
data PPHsMode = PPHsMode {
classIndent :: Indent
doIndent :: Indent
caseIndent :: Indent
letIndent :: Indent
whereIndent :: Indent
onsideIndent :: Indent
spacing :: Bool
layout :: PPLayout
linePragmas :: Bool
comments :: Bool
}
type Indent = Int
data PPLayout
= PPOffsideRule
| PPSemiColon
| PPInLine
| PPNoLayout
defaultMode :: PPHsMode
Pretty printing
class Pretty a
Things that can be pretty-printed, including all the syntactic objects in Language.Haskell.Syntax.
show/hide Instances
prettyPrintStyleMode :: Pretty a => Style -> PPHsMode -> a -> String
pretty-print with a given style and mode.
prettyPrintWithMode :: Pretty a => PPHsMode -> a -> String
pretty-print with the default style and a given mode.
prettyPrint :: Pretty a => a -> String
pretty-print with the default style and defaultMode.
Pretty-printing styles (from Text.PrettyPrint.HughesPJ)
Style
style
Mode
Haskell formatting modes
data PPHsMode

Pretty-printing parameters.

Note: the onsideIndent must be positive and less than all other indents.

Constructors
PPHsMode
classIndent :: Indentindentation of a class or instance
doIndent :: Indentindentation of a do-expression
caseIndent :: Indentindentation of the body of a case expression
letIndent :: Indentindentation of the declarations in a let expression
whereIndent :: Indentindentation of the declarations in a where clause
onsideIndent :: Indentindentation added for continuation lines that would otherwise be offside
spacing :: Boolblank lines between statements?
layout :: PPLayoutPretty-printing style to use
linePragmas :: Booladd GHC-style LINE pragmas to output?
comments :: Boolnot implemented yet
type Indent = Int
data PPLayout
Varieties of layout we can use.
Constructors
PPOffsideRuleclassical layout
PPSemiColonclassical layout made explicit
PPInLineinline decls, with newlines between them
PPNoLayouteverything on a single line
show/hide Instances
defaultMode :: PPHsMode
The default mode: pretty-print using the offside rule and sensible defaults.
Produced by Haddock version 0.8