Module DumSource

This module dumps arbitrary OCaml values into a human-readable format and always terminates.

Dum was derived from both the Size module and from the Std.dump function of Extlib formerly known as Dumper.

The output format is not formally defined and is meant only to be inspected by humans. The basic conventions (subject to change) are the following:

The rest is self-explanatory.

Sourceval default_lim : int ref

Default limit of the number of nodes to dump: 100. Strings account for one eighth of their length.

Sourceval default_show_lazy : bool ref

Whether to inspect lazy values. This is false by default.

Warning: this relies on unofficially documented material of the standard distribution (file lazy.ml) and lazy values altogether are an experimental feature of OCaml.

This functionality may disappear in the future.

Sourceval to_eformat : ?show_lazy:bool -> ?lim:int -> 'a -> Easy_format.t

Convert any OCaml value into an Easy_format.t tree.

Sourceval to_string : ?show_lazy:bool -> ?lim:int -> 'a -> string
Sourceval p : ?show_lazy:bool -> ?lim:int -> 'a -> string

Dump to a string. Dum.to_string and Dum.p are equivalent.

Sourceval to_stdout : ?show_lazy:bool -> ?lim:int -> 'a -> unit

Dump to stdout.

Sourceval to_stderr : ?show_lazy:bool -> ?lim:int -> 'a -> unit

Dump to stderr.

Sourceval to_channel : ?show_lazy:bool -> ?lim:int -> out_channel -> 'a -> unit

Dump to the specified out_channel

Sourceval to_formatter : ?show_lazy:bool -> ?lim:int -> Format.formatter -> 'a -> unit

Dump to a formatter created by the Format module.

Sourceval to_buffer : ?show_lazy:bool -> ?lim:int -> Buffer.t -> 'a -> unit

Dump to a buffer.