This module implements functions for structured pretty printing. In general, the functions obtain a value to be printed, and a printer driver and will then generates a printer. A printer driver is thereby a function of type PrnDrv : (string -> unit) that will later on consume a string to print it. Such a printer driver is given to a printer which has consequently type PrnDrv -> unit to finally print the value. Hence, given a printer driver p:PrnDrv, and a printer P:Printer, the function application (P p) finally prints the value that was used to generate the printer P. A pretty printer is function that maps a given precedence to a Printer. This concept allows one to easily print all kinds of values into files, strings, and output streams.
Type | Description |
a pretty printer requires in addition a precedence |
|
a printer receives a printer driver generated from an object to print it |
|
printer driver consume a string for printing it |
Function or value | Description |
|
decrease global identation
|
|
increase global identation
|
Full Usage:
Prn2File filename prnFn
Parameters:
string
prnFn : (string -> unit) -> unit
|
prints print function to file
|
|
prints given print function to stdout
|
|
converts print function to string
|
Full Usage:
Prn2Stream stream prnFn
Parameters:
StreamWriter
prnFn : (string -> unit) -> 'a
Returns: 'a
|
prints print function to an outstream
|
|
apply a printing function to a list of printing functions |
|
|
|
print an indented block |
|
|
|
print end of line
|
print n linebreaks
|
|
|
duplicate the given printing function n times |
|
prints a line and ignores indentation |
|
print identation
|
|
|
|
takes a list of printing function and another printing function, which is printed between each element of the list |
|
print all elements of the list in an indented block that is labelled by "label" |
|
print labelled line |
|
print a sequence in an indented line |
|
call a list of print functions |
Full Usage:
PrnMap prnFn seqL
Parameters:
'a -> 'b
seqL : 'a list
Returns: 'b list
|
map sequence of elements
|
|
|
|
print nothing
|
|
print all elements of the list in an indented block that is labelled by the printing function param |
|
print labelled line |
|
|
|
print space
|
print n spaces
|
|
|
|
|
print a string in a indented line
|
Full Usage:
PrnXMLAttributes attrList
Parameters:
(string * string) list
Returns: string
|
write XML attributes
|
|
write an XML element to output stream os |
|
write an XML element to output stream os
|
|
write an XML element to output stream os
|
|
write an XML declaration to output stream os
|
Full Usage:
indentDepth
Returns: int ref
|
|
Full Usage:
indentString
Returns: string
|
|
Full Usage:
leftDelim
Returns: string
|
left and right delimiters for grouping
|
Full Usage:
maxPrec
Returns: int
|
maximal precedence value for operators
|
|
print array constant, [e1, ..., en] |
|
print all elements of the list in an indented block |
|
|
|
print function, e.g.: fsym(e1, ..., en) |
|
print infix operator, e.g.: arg1+arg2 |
|
|
|
print line |
|
print sequence of elements by using printing function eFn |
Full Usage:
prnMap eFn eL
Parameters:
'a -> 'b
eL : 'a list
Returns: 'b list
|
map sequence of elements
|
|
|
|
print postfix operator, e.g.: arg+ |
|
print prefix operator, e.g.: +arg |
|
print quantifier, e.g.: !arg1:arg2. arg3 |
|
print roundfix operator, e.g.: |
|
print sequence of elements |
|
|
print ternary infix operator, e.g.: arg1 => arg2 | arg3 |
|
|
converter to normal printing functions
|
Full Usage:
rightDelim
Returns: string
|
|