signature PRINT structure Print : PRINT
This structure provides generic printers for values and types. It is solely intended as a debugging aid.
import structure Print from "x-alice:/lib/system/Print" import signature PRINT from "x-alice:/lib/system/PRINT-sig"
In the interactive toplevel the functions printVal and printType are available unqualified.
signature PRINT = sig val depth : int ref val width : int ref val layoutWidth : int ref val printVal : 'a -> unit val printType : 'a -> unit val outputVal : TextIO.outstream * 'a * int -> unit val outputType : TextIO.outstream * 'a * int -> unit exception Type val register : ('a -> string) -> unit end
Raised by function register when the passed printer does not operate on a suitable abstract type.
Control up to which depth and width nested and aggregated data structures are printed by printVal. Sub-structures beyond the depth limit are output as _, items of collections (e.g. lists) beyond the width limit are abbreviated to ... in the output.
Controls the width of the layout as performed by printVal and printType, i.e. the maximum number of characters on each line.
Pretty prints the value x to the stream strm in ML syntax. If the output exceeds w characters, output is broken into multiple lines appropriately.
The second form is equivalent to:
outputVal (TextIO.stdOut, x, !printWidth)
Pretty prints the type of value x to the stream strm in ML syntax. If the output exceeds w characters, output is broken into multiple lines appropriately.
The second form is equivalent to:
outputType (TextIO.stdOut, x, !printWidth)
Adds function f as a printer. The function must have a concrete type tyvarseq t -> string, where t has to be an abstract type. Further calls to outputVal use this function to transform values of any type tyseq t to a printable string representation. In the interactive toplevel, this also affects how evaluation results are printed..