ddc-base-0.2.0.1: Disciple Core language common utilities.

Safe HaskellSafe-Infered

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 whereSource

Methods

ppr :: a -> DocSource

pprPrec :: Int -> a -> DocSource

pprParen :: Bool -> Doc -> DocSource

Wrap a Doc in parens if the predicate is true.

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 -> StringSource

Render a doc with the given mode.

renderPlain :: Doc -> StringSource

Convert a Doc to a string without indentation.

renderIndent :: Doc -> StringSource

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.