CoreErlang-0.0.2: Manipulating Core Erlang source code

Portabilityportable
Stabilityexperimental
MaintainerAlex Kropivny <alex.kropivny@gmail.com>

Language.CoreErlang.Pretty

Contents

Description

Pretty printer for CoreErlang.

Synopsis

Pretty printing

class Pretty a Source

Things that can be pretty-printed, including all the syntactic objects in Language.CoreErlang.Syntax.

prettyPrintStyleMode :: Pretty a => Style -> PPMode -> a -> StringSource

pretty-print with a given style and mode.

prettyPrintWithMode :: Pretty a => PPMode -> 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

mode :: Mode

The rendering mode

lineLength :: Int

Length of line, in chars

ribbonsPerLine :: Float

Ratio of ribbon length to line length

style :: Style

The default style (mode=PageMode, lineLength=100, ribbonsPerLine=1.5).

data Mode

Rendering mode.

Constructors

PageMode

Normal

ZigZagMode

With zig-zag cuts

LeftMode

No indentation, infinitely long lines

OneLineMode

All on one line

CoreErlang formatting modes

data PPMode Source

Pretty-printing parameters.

Constructors

PPMode 

Fields

altIndent :: Indent

indentation of the alternatives in a case expression

caseIndent :: Indent

indentation of the declarations in a case expression

fundefIndent :: Indent

indentation of the declarations in a function definition

lambdaIndent :: Indent

indentation of the declarations in a lambda expression

letIndent :: Indent

indentation of the declarations in a let expression

letrecIndent :: Indent

indentation of the declarations in a letrec expression

onsideIndent :: Indent

indentation added for continuation lines that would otherwise be offside

layout :: PPLayout

Pretty-printing style to use

data PPLayout Source

Varieties of layout we can use.

Constructors

PPDefault

classical layout

PPNoLayout

everything on a single line

Instances

defaultMode :: PPModeSource

The default mode: pretty-print using sensible defaults.