bash-0.1.1: Bash generation library.

Language.Bash.PrettyPrinter.State

Description

Pretty printer state, used within a state monad computation.

Synopsis

Documentation

data PPState Source

State of pretty printing -- string being built, indent levels, present column, brace nesting.

Constructors

PPState 

Fields

indents :: [Word]
 
curly :: [()]
 
round :: [()]
 
columns :: Word
 
string :: Builder
 

Instances

render :: PPState -> State PPState () -> BuilderSource

Produce a builder from a pretty printer state computation.

nlCol :: Word -> PPStateSource

Pretty printer state starting on a new line indented to the given column.

data PPOp Source

Operations we can perform while pretty printing.

Constructors

Indent Word

Indent by N spaces.

Outdent

Remove and indentation level.

Word ByteString

Add a word to a line.

Newline

Move to newline.

Curly Bool

Introduce a level of braces.

Round Bool

Introduce a level of parens.

op :: PPState -> PPOp -> PPStateSource

Apply an operation to a state.