aterm-0.1.0.1: serialisation for Haskell values with sharing support

Portabilityportable
Stabilityprovisional
MaintainerChristian.Maeder@dfki.de

ATerm.SimpPretty

Contents

Description

Rather than using (slow, sequential) strings create (fast, tree-like) documents and render them later as text for IO.

A very simplified version of John Hughes's and Simon Peyton Jones's Pretty Printer Combinators. Only catenable string sequences are left over.

Synopsis

The document type

data SDoc Source

The abstract type of documents

Instances

Primitive documents

emptySource

Arguments

:: SDoc

An empty document

commaSource

Arguments

:: SDoc

A ',' character

Converting values into documents

Wrapping documents in delimiters

parensSource

Arguments

:: SDoc 
-> SDoc

Wrap document in (...)

bracketsSource

Arguments

:: SDoc 
-> SDoc

Wrap document in [...]

bracesSource

Arguments

:: SDoc 
-> SDoc

Wrap document in {...}

Combining documents

(<>)Source

Arguments

:: SDoc 
-> SDoc 
-> SDoc

Beside

Rendering documents

render :: SDoc -> StringSource

Renders the document as a string using the default style

fullRender :: (String -> a) -> (a -> a -> a) -> SDoc -> aSource