Module "Pretty.curry"

The interface is that of Daan Leijen's library (fill, fillBreak and indent are missing) with a linear-time, bounded implementation by Olaf Chitil.

Author: Sebastian Fischer

Version: October 2006


 Exported names:

Datatypes:
Doc

Functions:
<$$> | <$> | <+> | <//> | </> | <> | align | angles | backslash | bquotes | braces | brackets | cat | char | colon | combine | comma | compose | dot | dquote | dquotes | empty | enclose | encloseSep | equals | fillCat | fillEncloseSep | fillSep | float | group | hang | hcat | hEncloseSep | hsep | int | langle | lbrace | lbracket | line | linebreak | linesep | list | lparen | nest | parens | pretty | punctuate | rangle | rbrace | rbracket | rparen | semi | semiBraces | sep | softbreak | softline | space | squote | squotes | string | text | tupled | vcat | vsep


 Summary of exported functions:

empty  :: Doc  deterministic 
          The empty document is, indeed, empty.
text  :: String -> Doc  deterministic 
          The document (text s) contains the literal string s.
linesep  :: String -> Doc  deterministic 
          The document (linesep s) advances to the next line and indents to the current nesting level.
line  :: Doc  deterministic 
          The line document advances to the next line and indents to the current nesting level.
linebreak  :: Doc  deterministic 
          The linebreak document advances to the next line and indents to the current nesting level.
softline  :: Doc  deterministic 
          The document softline behaves like space if the resulting output fits the page, otherwise it behaves like line.

softline = group line
softbreak  :: Doc  deterministic 
          The document softbreak behaves like empty if the resulting output fits the page, otherwise it behaves like line.

softbreak = group linebreak
group  :: Doc -> Doc  deterministic 
          The group combinator is used to specify alternative layouts.
nest  :: Int -> Doc -> Doc  deterministic 
          The document (nest i d) renders document d with the current indentation level increased by i (See also hang, align and indent).

nest 2 (text "hello" <$> text "world") <$> text "!"

outputs as:

hello
  world
!
hang  :: Int -> Doc -> Doc  deterministic 
          The hang combinator implements hanging indentation.
align  :: Doc -> Doc  deterministic 
          The document (align d) renders document d with the nesting level set to the current column.
combine  :: Doc -> Doc -> Doc -> Doc  deterministic 
          The document (combine x l r) encloses document x between documents l and r using (<>).

combine x l r = l <> x <> r
(<>)  :: Doc -> Doc -> Doc  deterministic 
          The document (x <> y) concatenates document x and document y.
(<+>)  :: Doc -> Doc -> Doc  deterministic 
          The document (x <+> y) concatenates document x and y with a space in between.
(<$>)  :: Doc -> Doc -> Doc  deterministic 
          The document (x <$> y) concatenates document x and y with a line in between.
(</>)  :: Doc -> Doc -> Doc  deterministic 
          The document (x </> y) concatenates document x and y with a softline in between.
(<$$>)  :: Doc -> Doc -> Doc  deterministic 
          The document (x <$$> y) concatenates document x and y with a linebreak in between.
(<//>)  :: Doc -> Doc -> Doc  deterministic 
          The document (x <//> y) concatenates document x and y with a softbreak in between.
compose  :: (Doc -> Doc -> Doc) -> [Doc] -> Doc  deterministic flexible
          The document (compose f xs) concatenates all documents xs with function f.
hsep  :: [Doc] -> Doc  deterministic 
          The document (hsep xs) concatenates all documents xs horizontally with (<+>).
vsep  :: [Doc] -> Doc  deterministic 
          The document (vsep xs) concatenates all documents xs vertically with (<$>).
fillSep  :: [Doc] -> Doc  deterministic 
          The document (fillSep xs) concatenates documents xs horizontally with (<+>) as long as its fits the page, than inserts a line and continues doing that for all documents in xs.

fillSep xs = foldr (</>) empty xs
sep  :: [Doc] -> Doc  deterministic 
          The document (sep xs) concatenates all documents xs either horizontally with (<+>), if it fits the page, or vertically with (<$>).

sep xs = group (vsep xs)
hcat  :: [Doc] -> Doc  deterministic 
          The document (hcat xs) concatenates all documents xs horizontally with (<>).
vcat  :: [Doc] -> Doc  deterministic 
          The document (vcat xs) concatenates all documents xs vertically with (<$$>).
fillCat  :: [Doc] -> Doc  deterministic 
          The document (fillCat xs) concatenates documents xs horizontally with (<>) as long as its fits the page, than inserts a linebreak and continues doing that for all documents in xs.
cat  :: [Doc] -> Doc  deterministic 
          The document (cat xs) concatenates all documents xs either horizontally with (<>), if it fits the page, or vertically with (<$$>).

cat xs = group (vcat xs)
punctuate  :: Doc -> [Doc] -> [Doc]  deterministic flexible
          (punctuate p xs) concatenates all in documents xs with document p except for the last document.

someText = map text ["words","in","a","tuple"]
test = parens (align (cat (punctuate comma someText)))

This is layed out on a page width of 20 as:

(words,in,a,tuple)

But when the page width is 15, it is layed out as:

(words,
 in,
 a,
 tuple)

(If you want put the commas in front of their elements instead of at the end, you should use tupled or, in general, encloseSep.)
encloseSep  :: Doc -> Doc -> Doc -> [Doc] -> Doc  deterministic flexible
          The document (encloseSep l r sep xs) concatenates the documents xs seperated by sep and encloses the resulting document by l and r.
The documents are rendered horizontally if that fits the page.
hEncloseSep  :: Doc -> Doc -> Doc -> [Doc] -> Doc  deterministic flexible
          The document (hEncloseSep l r sep xs) concatenates the documents xs seperated by sep and encloses the resulting document by l and r.
The documents are rendered horizontally.
fillEncloseSep  :: Doc -> Doc -> Doc -> [Doc] -> Doc  deterministic flexible
          The document (hEncloseSep l r sep xs) concatenates the documents xs seperated by sep and encloses the resulting document by l and r.
The documents are rendered horizontally if that fits the page.
list  :: [Doc] -> Doc  deterministic 
          The document (list xs) comma seperates the documents xs and encloses them in square brackets.
tupled  :: [Doc] -> Doc  deterministic 
          The document (tupled xs) comma seperates the documents xs and encloses them in parenthesis.
semiBraces  :: [Doc] -> Doc  deterministic 
          The document (semiBraces xs) seperates the documents xs with semi colons and encloses them in braces.
enclose  :: Doc -> Doc -> Doc -> Doc  deterministic 
          The document (enclose l r x) encloses document x between documents l and r using (<>).

enclose l r x = l <> x <> r
squotes  :: Doc -> Doc  deterministic 
          Document (squotes x) encloses document x with single quotes "'".
dquotes  :: Doc -> Doc  deterministic 
          Document (dquotes x) encloses document x with double quotes '"'.
bquotes  :: Doc -> Doc  deterministic 
          Document (bquotes x) encloses document x with '`' quotes.
parens  :: Doc -> Doc  deterministic 
          Document (parens x) encloses document x in parenthesis, "(" and ")".
angles  :: Doc -> Doc  deterministic 
          Document (angles x) encloses document x in angles, "<" and ">".
braces  :: Doc -> Doc  deterministic 
          Document (braces x) encloses document x in braces, "{" and "}".
brackets  :: Doc -> Doc  deterministic 
          Document (brackets x) encloses document x in square brackets, "[" and "]".
char  :: Char -> Doc  deterministic 
          The document (char c) contains the literal character c.
string  :: String -> Doc  deterministic 
          The document (string s) concatenates all characters in s using line for newline characters and char for all other characters.
int  :: Int -> Doc  deterministic 
          The document (int i) shows the literal integer i using text.
float  :: Float -> Doc  deterministic 
          The document (float f) shows the literal float f using text.
lparen  :: Doc  deterministic 
          The document lparen contains a left parenthesis, "(".
rparen  :: Doc  deterministic 
          The document rparen contains a right parenthesis, ")".
langle  :: Doc  deterministic 
          The document langle contains a left angle, "<".
rangle  :: Doc  deterministic 
          The document rangle contains a right angle, ">".
lbrace  :: Doc  deterministic 
          The document lbrace contains a left brace, "{".
rbrace  :: Doc  deterministic 
          The document rbrace contains a right brace, "}".
lbracket  :: Doc  deterministic 
          The document lbracket contains a left square bracket, "[".
rbracket  :: Doc  deterministic 
          The document rbracket contains a right square bracket, "]".
squote  :: Doc  deterministic 
          The document squote contains a single quote, "'".
dquote  :: Doc  deterministic 
          The document dquote contains a double quote, '"'.
semi  :: Doc  deterministic 
          The document semi contains a semi colon, ";".
colon  :: Doc  deterministic 
          The document colon contains a colon, ":".
comma  :: Doc  deterministic 
          The document comma contains a comma, ",".
space  :: Doc  deterministic 
          The document space contains a single space, " ".

x <+> y = x <> space <> y
dot  :: Doc  deterministic 
          The document dot contains a single dot, ".".
backslash  :: Doc  deterministic 
          The document backslash contains a back slash, "\\".
equals  :: Doc  deterministic 
          The document equals contains an equal sign, "=".
pretty  :: Int -> Doc -> String  deterministic 
          (pretty w d) pretty prints document d with a page width of w characters

 Imported modules:

Dequeue
Prelude

 Exported datatypes:

Doc

The abstract data type Doc represents pretty documents.

Constructors:



 Exported functions:

empty :: Doc  deterministic 

The empty document is, indeed, empty. Allthough empty has no content, it does have a 'height' of 1 and behaves exactly like (text "") (and is therefore not a unit of <$>).

Returns:
an empty document
Further infos:
  • solution complete, i.e., able to compute all solutions

text :: String -> Doc  deterministic 

The document (text s) contains the literal string s. The string shouldn't contain any newline ('\n') characters. If the string contains newline characters, the function string should be used.

Example call:  (text s)

Parameters:
s - a string without newline ('\n') characters
Returns:
a document which contains the literal string
Further infos:
  • solution complete, i.e., able to compute all solutions

linesep :: String -> Doc  deterministic 

The document (linesep s) advances to the next line and indents to the current nesting level. Document (linesep s) behaves like (text s) if the line break is undone by group.

Example call:  (linesep s)

Parameters:
s - a string
Returns:
a document which advances to the next line or behaves like (text s)

line :: Doc  deterministic 

The line document advances to the next line and indents to the current nesting level. Document line behaves like (text " ") if the line break is undone by group.

Returns:
a document which advances to the next line or behaves like (text " ")

linebreak :: Doc  deterministic 

The linebreak document advances to the next line and indents to the current nesting level. Document linebreak behaves like empty if the line break is undone by group.

Returns:
a document which advances to the next line or behaves like (text "")

softline :: Doc  deterministic 

The document softline behaves like space if the resulting output fits the page, otherwise it behaves like line.

softline = group line

Returns:
a document which behaves like space or line

softbreak :: Doc  deterministic 

The document softbreak behaves like empty if the resulting output fits the page, otherwise it behaves like line.

softbreak = group linebreak

Returns:
a document which behaves like empty or line

group :: Doc -> Doc  deterministic 

The group combinator is used to specify alternative layouts. The document (group x) undoes all line breaks in document x. The resulting line is added to the current line if that fits the page. Otherwise, the document x is rendered without any changes.

Example call:  (group d)

Parameters:
d - a document
Returns:
document d without line breaks if that fits the page.

nest :: Int -> Doc -> Doc  deterministic 

The document (nest i d) renders document d with the current indentation level increased by i (See also hang, align and indent).

nest 2 (text "hello" <$> text "world") <$> text "!"

outputs as:

hello
  world
!

Example call:  (nest i d)

Parameters:
i - an integer which increases the indentation level
d - a document
Returns:
document d with an indentation level increased by i

hang :: Int -> Doc -> Doc  deterministic 

The hang combinator implements hanging indentation. The document (hang i d) renders document d with a nesting level set to the current column plus i. The following example uses hanging indentation for some text:

test = hang 4 (fillSep (map text
       (words "the hang combinator indents these words !")))

Which lays out on a page with a width of 20 characters as:

the hang combinator
    indents these
    words !

The hang combinator is implemented as:

hang i x = align (nest i x)

Example call:  (hang i d)

Parameters:
i - an integer which increases the indentation level
d - a document
Returns:
document d with an indentation level set to the current column plus i

align :: Doc -> Doc  deterministic 

The document (align d) renders document d with the nesting level set to the current column. It is used for example to implement hang.
As an example, we will put a document right above another one, regardless of the current nesting level:

x $$ y = align (x <$> y)
test = text "hi" <+> (text "nice" $$ text "world")

which will be layed out as:

hi nice
   world

Example call:  (align d)

Parameters:
d - a document
Returns:
document d with the nesting level set to the current column

combine :: Doc -> Doc -> Doc -> Doc  deterministic 

The document (combine x l r) encloses document x between documents l and r using (<>).

combine x l r = l <> x <> r

Example call:  (combine x l r)

Parameters:
x - the middle document
l - the left document
r - the right document
Returns:
concatenation of l, x and r

(<>) :: Doc -> Doc -> Doc  deterministic 

The document (x <> y) concatenates document x and document y. It is an associative operation having empty as a left and right unit.

Example call:  (x <> y)

Parameters:
x - the first document
y - the second document
Returns:
concatenation of x and y without seperator
Further infos:
  • defined as left-associative infix operator with precedence 1

(<+>) :: Doc -> Doc -> Doc  deterministic 

The document (x <+> y) concatenates document x and y with a space in between.

Example call:  (x <+> y)

Parameters:
x - the first document
y - the second document
Returns:
concatenation of x and y with a space in between
Further infos:
  • defined as left-associative infix operator with precedence 1

(<$>) :: Doc -> Doc -> Doc  deterministic 

The document (x <$> y) concatenates document x and y with a line in between.

Example call:  (x <$> y)

Parameters:
x - the first document
y - the second document
Returns:
concatenation of x and y with a line in between
Further infos:
  • defined as left-associative infix operator with precedence 1

(</>) :: Doc -> Doc -> Doc  deterministic 

The document (x </> y) concatenates document x and y with a softline in between. This effectively puts x and y either next to each other (with a space in between) or underneath each other.

Example call:  (x </> y)

Parameters:
x - the first document
y - the second document
Returns:
concatenation of x and y with a softline in between
Further infos:
  • defined as left-associative infix operator with precedence 1

(<$$>) :: Doc -> Doc -> Doc  deterministic 

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

Example call:  (x <$$> y)

Parameters:
x - the first document
y - the second document
Returns:
concatenation of x and y with a linebreak in between
Further infos:
  • defined as left-associative infix operator with precedence 1

(<//>) :: Doc -> Doc -> Doc  deterministic 

The document (x <//> y) concatenates document x and y with a softbreak in between. This effectively puts x and y either right next to each other or underneath each other.

Example call:  (x <//> y)

Parameters:
x - the first document
y - the second document
Returns:
concatenation of x and y with a softbreak in between
Further infos:
  • defined as left-associative infix operator with precedence 1

compose :: (Doc -> Doc -> Doc) -> [Doc] -> Doc  deterministic flexible

The document (compose f xs) concatenates all documents xs with function f. Function f should be like (<+>), (<$>) and so on.

Example call:  (compose f xs)

Parameters:
f - a combiner function
xs - a list of documents
Returns:
concatenation of documents

hsep :: [Doc] -> Doc  deterministic 

The document (hsep xs) concatenates all documents xs horizontally with (<+>).

Example call:  (hsep xs)

Parameters:
xs - a list of documents
Returns:
horizontal concatenation of documents

vsep :: [Doc] -> Doc  deterministic 

The document (vsep xs) concatenates all documents xs vertically with (<$>). If a group undoes the line breaks inserted by vsep, all documents are seperated with a space.

someText = map text (words ("text to lay out"))
test = text "some" <+> vsep someText

This is layed out as:

some text
to
lay
out

The align combinator can be used to align the documents under their first element

test = text "some" <+> align (vsep someText)

Which is printed as:

some text
     to
     lay
     out

Example call:  (vsep xs)

Parameters:
xs - a list of documents
Returns:
vertical concatenation of documents

fillSep :: [Doc] -> Doc  deterministic 

The document (fillSep xs) concatenates documents xs horizontally with (<+>) as long as its fits the page, than inserts a line and continues doing that for all documents in xs.

fillSep xs = foldr (</>) empty xs

Example call:  (fillSep xs)

Parameters:
xs - a list of documents
Returns:
horizontal concatenation of documents

sep :: [Doc] -> Doc  deterministic 

The document (sep xs) concatenates all documents xs either horizontally with (<+>), if it fits the page, or vertically with (<$>).

sep xs = group (vsep xs)

Example call:  (sep xs)

Parameters:
xs - a list of documents
Returns:
horizontal concatenation of documents, if it fits the page, or vertical concatenation else

hcat :: [Doc] -> Doc  deterministic 

The document (hcat xs) concatenates all documents xs horizontally with (<>).

Example call:  (hcat xs)

Parameters:
xs - a list of documents
Returns:
horizontal concatenation of documents

vcat :: [Doc] -> Doc  deterministic 

The document (vcat xs) concatenates all documents xs vertically with (<$$>). If a group undoes the line breaks inserted by vcat, all documents are directly concatenated.

Example call:  (vcat xs)

Parameters:
xs - a list of documents
Returns:
vertical concatenation of documents

fillCat :: [Doc] -> Doc  deterministic 

The document (fillCat xs) concatenates documents xs horizontally with (<>) as long as its fits the page, than inserts a linebreak and continues doing that for all documents in xs.

fillCat xs = foldr (<//>) empty xs

Example call:  (fillCat xs)

Parameters:
xs - a list of documents
Returns:
horizontal concatenation of documents

cat :: [Doc] -> Doc  deterministic 

The document (cat xs) concatenates all documents xs either horizontally with (<>), if it fits the page, or vertically with (<$$>).

cat xs = group (vcat xs)

Example call:  (cat xs)

Parameters:
xs - a list of documents
Returns:
horizontal concatenation of documents

punctuate :: Doc -> [Doc] -> [Doc]  deterministic flexible

(punctuate p xs) concatenates all in documents xs with document p except for the last document.

someText = map text ["words","in","a","tuple"]
test = parens (align (cat (punctuate comma someText)))

This is layed out on a page width of 20 as:

(words,in,a,tuple)

But when the page width is 15, it is layed out as:

(words,
 in,
 a,
 tuple)

(If you want put the commas in front of their elements instead of at the end, you should use tupled or, in general, encloseSep.)

Example call:  (punctuate p xs)

Parameters:
p - a document as seperator
xs - a list of documents
Returns:
concatenation of documents with p in between

encloseSep :: Doc -> Doc -> Doc -> [Doc] -> Doc  deterministic flexible

The document (encloseSep l r sep xs) concatenates the documents xs seperated by sep and encloses the resulting document by l and r.
The documents are rendered horizontally if that fits the page. Otherwise they are aligned vertically. All seperators are put in front of the elements.
For example, the combinator list can be defined with encloseSep:

list xs = encloseSep lbracket rbracket comma xs
test = text "list" <+> (list (map int [10,200,3000]))

Which is layed out with a page width of 20 as:

list [10,200,3000]

But when the page width is 15, it is layed out as:

list [10
     ,200
     ,3000]

Example call:  (encloseSep l r sep xs)

Parameters:
l - left document
r - right document
sep - a document as seperator
xs - a list of documents
Returns:
concatenation of l, xs (with p in between) and r

hEncloseSep :: Doc -> Doc -> Doc -> [Doc] -> Doc  deterministic flexible

The document (hEncloseSep l r sep xs) concatenates the documents xs seperated by sep and encloses the resulting document by l and r.
The documents are rendered horizontally.

Example call:  (hEncloseSep l r sep xs)

Parameters:
l - left document
r - right document
sep - a document as seperator
xs - a list of documents
Returns:
concatenation of l, xs (with p in between) and r

fillEncloseSep :: Doc -> Doc -> Doc -> [Doc] -> Doc  deterministic flexible

The document (hEncloseSep l r sep xs) concatenates the documents xs seperated by sep and encloses the resulting document by l and r.
The documents are rendered horizontally if that fits the page. Otherwise they are aligned vertically. All seperators are put in front of the elements.

Example call:  (fillEncloseSep l r sep xs)

Parameters:
l - left document
r - right document
sep - a document as seperator
xs - a list of documents
Returns:
concatenation of l, xs (with p in between) and r

list :: [Doc] -> Doc  deterministic 

The document (list xs) comma seperates the documents xs and encloses them in square brackets. The documents are rendered horizontally if that fits the page. Otherwise they are aligned vertically. All comma seperators are put in front of the elements.

Example call:  (list xs)

Parameters:
xs - a list of documents
Returns:
comma seperated documents xs and enclosed in square brackets

tupled :: [Doc] -> Doc  deterministic 

The document (tupled xs) comma seperates the documents xs and encloses them in parenthesis. The documents are rendered horizontally if that fits the page. Otherwise they are aligned vertically. All comma seperators are put in front of the elements.

Example call:  (tupled xs)

Parameters:
xs - a list of documents
Returns:
comma seperated documents xs and enclosed in parenthesis

semiBraces :: [Doc] -> Doc  deterministic 

The document (semiBraces xs) seperates the documents xs with semi colons and encloses them in braces. The documents are rendered horizontally if that fits the page. Otherwise they are aligned vertically. All semi colons are put in front of the elements.

Example call:  (semiBraces xs)

Parameters:
xs - a list of documents
Returns:
documents xs seperated with semi colons and enclosed in braces

enclose :: Doc -> Doc -> Doc -> Doc  deterministic 

The document (enclose l r x) encloses document x between documents l and r using (<>).

enclose l r x = l <> x <> r

Example call:  (enclose l r x)

Parameters:
l - the left document
r - the right document
x - the middle document
Returns:
concatenation of l, x and r

squotes :: Doc -> Doc  deterministic 

Document (squotes x) encloses document x with single quotes "'".

Example call:  (squotes x)

Parameters:
x - a document
Returns:
document x enclosed by single quotes

dquotes :: Doc -> Doc  deterministic 

Document (dquotes x) encloses document x with double quotes '"'.

Example call:  (dquotes x)

Parameters:
x - a document
Returns:
document x enclosed by double quotes

bquotes :: Doc -> Doc  deterministic 

Document (bquotes x) encloses document x with '`' quotes.

Example call:  (bquotes x)

Parameters:
x - a document
Returns:
document x enclosed by '`' quotes

parens :: Doc -> Doc  deterministic 

Document (parens x) encloses document x in parenthesis, "(" and ")".

Example call:  (parens x)

Parameters:
x - a document
Returns:
document x enclosed in parenthesis

angles :: Doc -> Doc  deterministic 

Document (angles x) encloses document x in angles, "<" and ">".

Example call:  (angles x)

Parameters:
x - a document
Returns:
document x enclosed in angles

braces :: Doc -> Doc  deterministic 

Document (braces x) encloses document x in braces, "{" and "}".

Example call:  (braces x)

Parameters:
x - a document
Returns:
document x enclosed in braces

brackets :: Doc -> Doc  deterministic 

Document (brackets x) encloses document x in square brackets, "[" and "]".

Example call:  (brackets x)

Parameters:
x - a document
Returns:
document x enclosed in square brackets

char :: Char -> Doc  deterministic 

The document (char c) contains the literal character c. The character shouldn't be a newline ('\n'), the function line should be used for line breaks.

Example call:  (char c)

Parameters:
c - a character
Returns:
a document which contains the literal character c
Further infos:
  • solution complete, i.e., able to compute all solutions

string :: String -> Doc  deterministic 

The document (string s) concatenates all characters in s using line for newline characters and char for all other characters. It is used instead of text whenever the text contains newline characters.

Example call:  (string s)

Parameters:
s - a string
Returns:
a document which contains the string s

int :: Int -> Doc  deterministic 

The document (int i) shows the literal integer i using text.

Example call:  (int i)

Parameters:
i - an integer
Returns:
a document which contains the integer i

float :: Float -> Doc  deterministic 

The document (float f) shows the literal float f using text.

Example call:  (float f)

Parameters:
f - a float
Returns:
a document which contains the float f

lparen :: Doc  deterministic 

The document lparen contains a left parenthesis, "(".

Returns:
a document which contains a left parenthesis
Further infos:
  • solution complete, i.e., able to compute all solutions

rparen :: Doc  deterministic 

The document rparen contains a right parenthesis, ")".

Returns:
a document which contains a right parenthesis
Further infos:
  • solution complete, i.e., able to compute all solutions

langle :: Doc  deterministic 

The document langle contains a left angle, "<".

Returns:
a document which contains a left angle
Further infos:
  • solution complete, i.e., able to compute all solutions

rangle :: Doc  deterministic 

The document rangle contains a right angle, ">".

Returns:
a document which contains a right angle
Further infos:
  • solution complete, i.e., able to compute all solutions

lbrace :: Doc  deterministic 

The document lbrace contains a left brace, "{".

Returns:
a document which contains a left brace
Further infos:
  • solution complete, i.e., able to compute all solutions

rbrace :: Doc  deterministic 

The document rbrace contains a right brace, "}".

Returns:
a document which contains a right brace
Further infos:
  • solution complete, i.e., able to compute all solutions

lbracket :: Doc  deterministic 

The document lbracket contains a left square bracket, "[".

Returns:
a document which contains a left square bracket
Further infos:
  • solution complete, i.e., able to compute all solutions

rbracket :: Doc  deterministic 

The document rbracket contains a right square bracket, "]".

Returns:
a document which contains a right square bracket
Further infos:
  • solution complete, i.e., able to compute all solutions

squote :: Doc  deterministic 

The document squote contains a single quote, "'".

Returns:
a document which contains a single quote
Further infos:
  • solution complete, i.e., able to compute all solutions

dquote :: Doc  deterministic 

The document dquote contains a double quote, '"'.

Returns:
a document which contains a double quote
Further infos:
  • solution complete, i.e., able to compute all solutions

semi :: Doc  deterministic 

The document semi contains a semi colon, ";".

Returns:
a document which contains a semi colon
Further infos:
  • solution complete, i.e., able to compute all solutions

colon :: Doc  deterministic 

The document colon contains a colon, ":".

Returns:
a document which contains a colon
Further infos:
  • solution complete, i.e., able to compute all solutions

comma :: Doc  deterministic 

The document comma contains a comma, ",".

Returns:
a document which contains a comma
Further infos:
  • solution complete, i.e., able to compute all solutions

space :: Doc  deterministic 

The document space contains a single space, " ".

x <+> y = x <> space <> y

Returns:
a document which contains a single space
Further infos:
  • solution complete, i.e., able to compute all solutions

dot :: Doc  deterministic 

The document dot contains a single dot, ".".

Returns:
a document which contains a single dot
Further infos:
  • solution complete, i.e., able to compute all solutions

backslash :: Doc  deterministic 

The document backslash contains a back slash, "\\".

Returns:
a document which contains a back slash
Further infos:
  • solution complete, i.e., able to compute all solutions

equals :: Doc  deterministic 

The document equals contains an equal sign, "=".

Returns:
a document which contains an equal
Further infos:
  • solution complete, i.e., able to compute all solutions

pretty :: Int -> Doc -> String  deterministic 

(pretty w d) pretty prints document d with a page width of w characters

Example call:  (pretty w d)

Parameters:
w - width of page
d - a document
Returns:
pretty printed document


Generated by CurryDoc (Version 0.4.1 of June 7, 2007) at Jun 16 17:15:00 2009