bash-0.1.3: 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
 
separated :: Bool
 
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 an indentation level.

Bytes ByteString

Add bytes to the script.

Newline

Move to newline.

WordSeparator

Separate words with space.

Curly Bool

Introduce a level of braces.

Round Bool

Introduce a level of parens.

op :: PPState -> PPOp -> PPStateSource

Apply an operation to a state.

indentPadToNextWord :: State PPState ()Source

This procedure is used in printing statements within evals, to set up indentation correctly for lines following the first line. It ensures that the second and following lines are printed aligned with the first character of the first line of the statement, not the first character of the $(, >( or <( enclosing the eval.