PPrint.OCamlThis 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 -> documentvariant _ 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 -> documentrecord _ fields represents a record value whose fields are fields. The other parameter is presently unused.
val string : string -> documentstring s represents the literal string s.
val int : int -> documentint i represents the literal integer i.
val int32 : int32 -> documentint32 i represents the literal 32-bit integer i.
val int64 : int64 -> documentint64 i represents the literal 64-bit integer i.
val nativeint : nativeint -> documentnativeint i represents the literal native integer i.
val float : float -> documentfloat f represents the literal floating-point number f.
val char : char -> documentchar c represents the literal character c.
val bool : bool -> documentbool b represents the Boolean value b.
val unit : documentunit 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.
ref r represents the reference r. The representation of the content is computed by the function f.