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

Safe HaskellNone

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

Associated Types

data PrettyMode a Source

Methods

pprDefaultMode :: PrettyMode aSource

ppr :: a -> DocSource

pprPrec :: Int -> a -> DocSource

pprModePrec :: PrettyMode a -> Int -> a -> DocSource

Instances

Pretty Bool 
Pretty Char 
Pretty Int 
Pretty Integer 
Pretty () 
Pretty Message 
Pretty ParseError 
Pretty SourcePos 
Pretty a => Pretty [a] 
Pretty a => Pretty (Set a) 
(Pretty a, Pretty b) => Pretty (a, b) 

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.

Instances

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.