tamarin-prover-utils-0.6.0.0: Utility library for the tamarin prover.

MaintainerSimon Meier <iridcode@gmail.com>
Safe HaskellSafe-Infered

Text.PrettyPrint.Class

Contents

Description

Document class allowing to have different interpretations of the HughesPJ pretty-printing combinators.

Synopsis

Documentation

data Doc

The abstract type of documents. A Doc represents a *set* of layouts. A Doc with no occurrences of Union or NoDoc represents just one layout.

class (Monoid d, NFData d) => Document d whereSource

Methods

char :: Char -> dSource

text :: String -> dSource

zeroWidthText :: String -> dSource

(<->) :: d -> d -> dSource

hcat :: [d] -> dSource

hsep :: [d] -> dSource

($$) :: d -> d -> dSource

($-$) :: d -> d -> dSource

vcat :: [d] -> dSource

sep :: [d] -> dSource

cat :: [d] -> dSource

fsep :: [d] -> dSource

fcat :: [d] -> dSource

nest :: Int -> d -> dSource

caseEmptyDoc :: d -> d -> d -> dSource

Instances

Document Doc 
Document d => Document (NoHtmlDoc d) 
Document d => Document (HtmlDoc d) 

isEmpty :: Doc -> Bool

Returns True if the document is empty

render :: Doc -> String

Render the Doc to a String using the default Style.

renderStyle :: Style -> Doc -> String

Render the Doc to a String using the given Style.

data Style

A rendering style.

Constructors

Style 

Fields

mode :: Mode

The rendering mode

lineLength :: Int

Length of line, in chars

ribbonsPerLine :: Float

Ratio of ribbon length to line length

data Mode

Rendering mode.

Constructors

PageMode

Normal

ZigZagMode

With zig-zag cuts

LeftMode

No indentation, infinitely long lines

OneLineMode

All on one line

($--$) :: Document d => d -> d -> dSource

Vertical concatentation of two documents with an empty line in between.

emptyDoc :: Document d => dSource

The empty document.

(<>) :: Monoid m => m -> m -> m

An infix synonym for mappend.

int :: Document d => Int -> dSource

hang :: Document d => d -> Int -> d -> dSource

punctuate :: Document d => d -> [d] -> [d]Source

Additional combinators

nestBetweenSource

Arguments

:: Document d 
=> Int

Indent of body

-> d

Leading document

-> d

Finishing document

-> d

Body document

-> d 

Nest a document surrounded by a leading and a finishing document breaking lead, body, and finish onto separate lines, if they don't fit on a single line.

nestShortSource

Arguments

:: Document d 
=> Int

Indent of body

-> d

Leading document

-> d

Finishing document

-> d

Body document

-> d 

Nest a document surrounded by a leading and a finishing document with an non-compulsory break between lead and body.

nestShort' :: Document d => String -> String -> d -> dSource

Nest document between two strings and indent body by length lead + 1.

nestShortNonEmpty :: Document d => Int -> d -> d -> d -> dSource

Like nestShort but doesn't print the lead and finish, if the document is empty.

nestShortNonEmpty' :: Document d => String -> String -> d -> dSource

Like nestShort' but doesn't print the lead and finish, if the document is empty.

fixedWidthText :: Document d => Int -> String -> dSource

Output text with a fixed width: if it is smaller then nothing happens, otherwise care is taken to make the text appear having the given width.

symbol :: Document d => String -> dSource

Print string as symbol having width 1.

numbered :: Document d => d -> [d] -> dSource

Number a list of documents that are vertically separated by the given separator.

numbered' :: Document d => [d] -> dSource

Number a list of documents with numbers terminated by . and vertically separate using an empty line.