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

Copyright(c) 2011 Simon Meier
LicenseGPL v3 (see LICENSE)
MaintainerSimon Meier <iridcode@gmail.com>
Safe HaskellSafe
LanguageHaskell98

Text.PrettyPrint.Class

Contents

Description

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

Synopsis

Documentation

data Doc #

Instances

Monoid Doc # 

Methods

mempty :: Doc #

mappend :: Doc -> Doc -> Doc #

mconcat :: [Doc] -> Doc #

NFData Doc # 

Methods

rnf :: Doc -> () #

Document Doc # 

Methods

char :: Char -> Doc #

text :: String -> Doc #

zeroWidthText :: String -> Doc #

(<->) :: Doc -> Doc -> Doc #

hcat :: [Doc] -> Doc #

hsep :: [Doc] -> Doc #

($$) :: Doc -> Doc -> Doc #

($-$) :: Doc -> Doc -> Doc #

vcat :: [Doc] -> Doc #

sep :: [Doc] -> Doc #

cat :: [Doc] -> Doc #

fsep :: [Doc] -> Doc #

fcat :: [Doc] -> Doc #

nest :: Int -> Doc -> Doc #

caseEmptyDoc :: Doc -> Doc -> Doc -> Doc #

HighlightDocument Doc # 

Methods

highlight :: HighlightStyle -> Doc -> Doc #

class (Monoid d, NFData d) => Document d where #

Minimal complete definition

char, text, zeroWidthText, (<->), hcat, hsep, ($$), ($-$), vcat, sep, cat, fsep, fcat, nest, caseEmptyDoc

Methods

char :: Char -> d #

text :: String -> d #

zeroWidthText :: String -> d #

(<->) :: d -> d -> d infixr 6 #

hcat :: [d] -> d #

hsep :: [d] -> d #

($$) :: d -> d -> d infixl 5 #

($-$) :: d -> d -> d infixl 5 #

vcat :: [d] -> d #

sep :: [d] -> d #

cat :: [d] -> d #

fsep :: [d] -> d #

fcat :: [d] -> d #

nest :: Int -> d -> d #

caseEmptyDoc :: d -> d -> d -> d #

Instances

Document Doc # 

Methods

char :: Char -> Doc #

text :: String -> Doc #

zeroWidthText :: String -> Doc #

(<->) :: Doc -> Doc -> Doc #

hcat :: [Doc] -> Doc #

hsep :: [Doc] -> Doc #

($$) :: Doc -> Doc -> Doc #

($-$) :: Doc -> Doc -> Doc #

vcat :: [Doc] -> Doc #

sep :: [Doc] -> Doc #

cat :: [Doc] -> Doc #

fsep :: [Doc] -> Doc #

fcat :: [Doc] -> Doc #

nest :: Int -> Doc -> Doc #

caseEmptyDoc :: Doc -> Doc -> Doc -> Doc #

Document d => Document (HtmlDoc d) # 

Methods

char :: Char -> HtmlDoc d #

text :: String -> HtmlDoc d #

zeroWidthText :: String -> HtmlDoc d #

(<->) :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d #

hcat :: [HtmlDoc d] -> HtmlDoc d #

hsep :: [HtmlDoc d] -> HtmlDoc d #

($$) :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d #

($-$) :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d #

vcat :: [HtmlDoc d] -> HtmlDoc d #

sep :: [HtmlDoc d] -> HtmlDoc d #

cat :: [HtmlDoc d] -> HtmlDoc d #

fsep :: [HtmlDoc d] -> HtmlDoc d #

fcat :: [HtmlDoc d] -> HtmlDoc d #

nest :: Int -> HtmlDoc d -> HtmlDoc d #

caseEmptyDoc :: HtmlDoc d -> HtmlDoc d -> HtmlDoc d -> HtmlDoc d #

defaultStyle :: Style #

The default Style.

data Style :: * #

A rendering style. Allows us to specify constraints to choose among the many different rendering options.

Constructors

Style 

Fields

  • mode :: Mode

    The rendering mode.

  • lineLength :: Int

    Maximum length of a line, in characters.

  • ribbonsPerLine :: Float

    Ratio of line length to ribbon length. A ribbon refers to the characters on a line excluding indentation. So a lineLength of 100, with a ribbonsPerLine of 2.0 would only allow up to 50 characters of ribbon to be displayed on a line, while allowing it to be indented up to 50 characters.

Instances

Eq Style 

Methods

(==) :: Style -> Style -> Bool #

(/=) :: Style -> Style -> Bool #

Show Style 

Methods

showsPrec :: Int -> Style -> ShowS #

show :: Style -> String #

showList :: [Style] -> ShowS #

Generic Style 

Associated Types

type Rep Style :: * -> * #

Methods

from :: Style -> Rep Style x #

to :: Rep Style x -> Style #

type Rep Style 

data Mode :: * #

Rendering mode.

Constructors

PageMode

Normal rendering (lineLength and ribbonsPerLine respected').

ZigZagMode

With zig-zag cuts.

LeftMode

No indentation, infinitely long lines (lineLength ignored), but explicit new lines, i.e., text "one" $$ text "two", are respected.

OneLineMode

All on one line, lineLength ignored and explicit new lines ($$) are turned into spaces.

Instances

Eq Mode 

Methods

(==) :: Mode -> Mode -> Bool #

(/=) :: Mode -> Mode -> Bool #

Show Mode 

Methods

showsPrec :: Int -> Mode -> ShowS #

show :: Mode -> String #

showList :: [Mode] -> ShowS #

Generic Mode 

Associated Types

type Rep Mode :: * -> * #

Methods

from :: Mode -> Rep Mode x #

to :: Rep Mode x -> Mode #

type Rep Mode 
type Rep Mode = D1 (MetaData "Mode" "Text.PrettyPrint.Annotated.HughesPJ" "pretty-1.1.3.3" False) ((:+:) ((:+:) (C1 (MetaCons "PageMode" PrefixI False) U1) (C1 (MetaCons "ZigZagMode" PrefixI False) U1)) ((:+:) (C1 (MetaCons "LeftMode" PrefixI False) U1) (C1 (MetaCons "OneLineMode" PrefixI False) U1)))

($--$) :: Document d => d -> d -> d infixl 5 #

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

emptyDoc :: Document d => d #

The empty document.

(<>) :: Monoid m => m -> m -> m infixr 6 #

An infix synonym for mappend.

Since: 4.5.0.0

semi :: Document d => d #

colon :: Document d => d #

comma :: Document d => d #

space :: Document d => d #

equals :: Document d => d #

lparen :: Document d => d #

rparen :: Document d => d #

lbrack :: Document d => d #

rbrack :: Document d => d #

lbrace :: Document d => d #

rbrace :: Document d => d #

int :: Document d => Int -> d #

integer :: Document d => Integer -> d #

float :: Document d => Float -> d #

double :: Document d => Double -> d #

quotes :: Document d => d -> d #

doubleQuotes :: Document d => d -> d #

parens :: Document d => d -> d #

brackets :: Document d => d -> d #

braces :: Document d => d -> d #

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

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

Additional combinators

nestBetween #

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.

nestShort #

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 -> d #

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

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

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

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

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

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

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 -> d #

Print string as symbol having width 1.

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

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

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

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