Printer Module
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.
Types
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 |
Functions and values
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
|
|
|
Full Usage:
Prn2Stream stream prnFn
Parameters:
StreamWriter
prnFn : (string -> unit) -> 'a
Returns: 'a
|
prints print function to an outstream
|
|
|
|
|
|
|
|
|
|
print end of line
|
|
|
|
|
|
print identation
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
PrnMap prnFn seqL
Parameters:
'a -> 'b
seqL : 'a list
Returns: 'b list
|
map sequence of elements
|
|
|
|
print nothing
|
|
|
|
|
|
|
|
print space
|
|
|
|
print a string in a indented line
|
Full Usage:
PrnXMLAttributes attrList
Parameters:
(string * string) list
Returns: string
|
write XML attributes
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
prnMap eFn eL
Parameters:
'a -> 'b
eL : 'a list
Returns: 'b list
|
map sequence of elements
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Full Usage:
rightDelim
Returns: string
|
|