Legend:
Library
Module
Module type
Parameter
Class
Class type
Library
Module
Module type
Parameter
Class
Class type
This module offers document combinators that help print OCaml values. The strings produced by rendering these documents are supposed to be accepted by the OCaml parser as valid values.
These functions do not distinguish between mutable and immutable values. They do not recognize sharing, and do not incorporate a protection against cyclic values.
val variant : type_name -> constructor -> tag -> document list -> document
variant _ dc _ args
represents a constructed value whose data constructor is dc
and whose arguments are args
. The other two parameters are presently unused.
val record : type_name -> (record_field * document) list -> document
record _ fields
represents a record value whose fields are fields
. The other parameter is presently unused.
val string : string -> document
string s
represents the literal string s
.
val int : int -> document
int i
represents the literal integer i
.
val int32 : int32 -> document
int32 i
represents the literal 32-bit integer i
.
val int64 : int64 -> document
int64 i
represents the literal 64-bit integer i
.
val nativeint : nativeint -> document
nativeint i
represents the literal native integer i
.
val float : float -> document
float f
represents the literal floating-point number f
.
val char : char -> document
char c
represents the literal character c
.
val bool : bool -> document
bool b
represents the Boolean value b
.
val unit : document
unit
represents the unit constant ()
.
option f o
represents the option o
. The representation of the element, if present, is computed by the function f
.
list f xs
represents the list xs
. The representation of each element is computed by the function f
. If the whole list fits on a single line, then it is printed on a single line; otherwise each element is printed on a separate line.
flowing_list f xs
represents the list xs
. The representation of each element is computed by the function f
. As many elements are possible are printed on each line.
array f xs
represents the array xs
. The representation of each element is computed by the function f
. If the whole array fits on a single line, then it is printed on a single line; otherwise each element is printed on a separate line.
flowing_array f xs
represents the array xs
. The representation of each element is computed by the function f
. As many elements are possible are printed on each line.
val ref : ('a -> document) -> 'a Pervasives.ref -> document
ref r
represents the reference r
. The representation of the content is computed by the function f
.