CoreErlang-0.0.3: Manipulating Core Erlang source code

Copyright(c) Henrique Ferreiro García 2008 (c) David Castro Pérez 2008
LicenseBSD-style (see the file LICENSE)
MaintainerAlex Kropivny <alex.kropivny@gmail.com>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

Language.CoreErlang.Pretty

Contents

Description

Pretty printer for CoreErlang.

Synopsis

Pretty printing

prettyPrintStyleMode :: Pretty a => Style -> PPMode -> a -> String Source

pretty-print with a given style and mode.

prettyPrintWithMode :: Pretty a => PPMode -> a -> String Source

pretty-print with the default style and a given mode.

prettyPrint :: Pretty a => a -> String Source

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 line length to ribbon length

Instances

Eq Style 
Show Style 
Generic Style 
type Rep Style = D1 D1Style (C1 C1_0Style ((:*:) (S1 S1_0_0Style (Rec0 Mode)) ((:*:) (S1 S1_0_1Style (Rec0 Int)) (S1 S1_0_2Style (Rec0 Float))))) 

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

Instances

Eq Mode 
Show Mode 
Generic Mode 
type Rep Mode = D1 D1Mode ((:+:) ((:+:) (C1 C1_0Mode U1) (C1 C1_1Mode U1)) ((:+:) (C1 C1_2Mode U1) (C1 C1_3Mode U1))) 

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 :: PPMode Source

The default mode: pretty-print using sensible defaults.