aterm-0.1.0.2: serialisation for Haskell values with sharing support

Copyright(c) Klaus Luettich C. Maeder Uni Bremen 2002-2005
LicenseGPLv2 or higher, see LICENSE.txt
MaintainerChristian.Maeder@dfki.de
Stabilityprovisional
Portabilityportable
Safe HaskellSafe
LanguageHaskell98

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
Show SDoc Source # 
Instance details

Defined in ATerm.SimpPretty

Methods

showsPrec :: Int -> SDoc -> ShowS #

show :: SDoc -> String #

showList :: [SDoc] -> ShowS #

Primitive documents

empty Source #

Arguments

:: SDoc

An empty document

comma Source #

Arguments

:: SDoc

A ',' character

Converting values into documents

Wrapping documents in delimiters

parens Source #

Arguments

:: SDoc 
-> SDoc

Wrap document in (...)

brackets Source #

Arguments

:: SDoc 
-> SDoc

Wrap document in [...]

braces Source #

Arguments

:: SDoc 
-> SDoc

Wrap document in {...}

Combining documents

(<>) infixl 6 Source #

Arguments

:: SDoc 
-> SDoc 
-> SDoc

Beside

Rendering documents

render :: SDoc -> String Source #

Renders the document as a string using the default style

fullRender :: (String -> a) -> (a -> a -> a) -> SDoc -> a Source #