pretty-compact-2.1: Pretty-printing library

Safe HaskellNone
LanguageHaskell98

Text.PrettyPrint.Compact.Core

Documentation

type Annotation a = (Eq a, Monoid a) Source #

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, Monoid a, Eq a) 
=> Options a r

rendering options

-> Doc a

renderable

-> r 

data Options a r Source #

Constructors

Options 

Fields

class Layout d => Document d where Source #

Minimal complete definition

(<|>), empty

Methods

(<|>) :: Eq a => d a -> d a -> d a Source #

empty :: d a Source #

type Doc = DDoc Source #

singleLine :: forall a. Monoid a => DDoc a -> DDoc a Source #