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 printWidth : 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.
Controls the width of the output 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. Raises Type if the type of f is not of the required form. This includes the case that t is not an abstract type, or that f is not fully polymorphic in the type arguments tyseq to t. Note that these rules also preclude f from being too polymorphic, i.e. being of type 'a -> string, because in that case no type name could be derived.