ddc-base-0.4.2.1: Disciplined Disciple Compiler common utilities.

Safe HaskellNone
LanguageHaskell98

DDC.Base.Pretty

Contents

Description

Pretty printer utilities.

This is a re-export of Daan Leijen's pretty printer package (wl-pprint), but with a Pretty class that includes a pprPrec function.

Synopsis

Documentation

class Pretty a where Source

Minimal complete definition

pprDefaultMode

Associated Types

data PrettyMode a Source

pprParen :: Bool -> Doc -> Doc Source

Wrap a Doc in parens if the predicate is true.

padL :: Int -> Doc -> Doc Source

Rendering

data RenderMode Source

How to pretty print a doc.

Constructors

RenderPlain

Render the doc with indenting.

RenderIndent

Render the doc without indenting.

render :: RenderMode -> Doc -> String Source

Render a doc with the given mode.

renderPlain :: Doc -> String Source

Convert a Doc to a string without indentation.

renderIndent :: Doc -> String Source

Convert a Doc to a string with indentation

putDoc :: RenderMode -> Doc -> IO () Source

Put a Doc to stdout using the given mode.

putDocLn :: RenderMode -> Doc -> IO () Source

Put a Doc to stdout using the given mode.