pretty-compact-3.0: Pretty-printing library

Safe HaskellNone
LanguageHaskell98

Text.PrettyPrint.Compact.Core

Synopsis

Documentation

class Layout d where Source #

Minimal complete definition

text, flush, annotate

Methods

text :: Monoid a => String -> d a Source #

flush :: Monoid a => d a -> d a Source #

annotate :: forall a. Monoid a => a -> d a -> d a Source #

<> new annotation to the Doc.

Example: 'Any True' annotation will transform the rendered Doc into uppercase:

>>> let r = putStrLn . renderWith defaultOptions { optsAnnotate = \a x -> if a == Any True then map toUpper x else x }
>>> r $ text "hello" <$$> annotate (Any True) (text "world")
hello
WORLD

renderWith Source #

Arguments

:: (Monoid r, Annotation a) 
=> Options a r

rendering options

-> ODoc a

renderable

-> r 

data Options a r Source #

Constructors

Options 

Fields

groupingBy :: Monoid a => String -> [(Int, Doc a)] -> Doc a Source #

type Doc = ODoc Source #

($$) :: (Layout d, Monoid a, Semigroup (d a)) => d a -> d a -> d a Source #

The document (x $$> y) concatenates document x and y with a linebreak in between. (infixr 5)