module Dump:sig
..end
Formatters for inspecting OCaml values.
Formatters of this module dump OCaml value with little control over the representation but with good default box structures and, whenever possible, using OCaml syntax.
val signal : int Fmt.t
signal
formats an OCaml signal number as a C
POSIX
constant or "SIG(%d)"
the signal number is unknown.
val uchar : Stdlib.Uchar.t Fmt.t
uchar
formats an OCaml Uchar.t
value using only US-ASCII
encoded characters according to the Unicode
notational
convention for code points.
val string : string Fmt.t
string
is pf ppf "%S"
.
val pair : 'a Fmt.t -> 'b Fmt.t -> ('a * 'b) Fmt.t
pair pp_fst pp_snd
formats an OCaml pair using pp_fst
and pp_snd
for the first and second projection.
val option : 'a Fmt.t -> 'a option Fmt.t
option pp_v
formats an OCaml option using pp_v
for the Some
case. No parentheses are added.
val result : ok:'a Fmt.t -> error:'b Fmt.t -> ('a, 'b) Stdlib.result Fmt.t
result ~ok ~error
formats an OCaml result using ok
for the Ok
case value and error
for the Error
case value. No parentheses
are added.
val list : 'a Fmt.t -> 'a list Fmt.t
list pp_v
formats an OCaml list using pp_v
for the list
elements.
val array : 'a Fmt.t -> 'a array Fmt.t
array pp_v
formats an OCaml array using pp_v
for the array
elements.
val seq : 'a Fmt.t -> 'a Stdlib.Seq.t Fmt.t
seq pp_v
formats an OCaml sequence using pp_v
for the sequence
elements.
val hashtbl : 'a Fmt.t -> 'b Fmt.t -> ('a, 'b) Stdlib.Hashtbl.t Fmt.t
hashtbl pp_k pp_v
formats an unspecified representation of the
bindings of a hash table using pp_k
for the keys and pp_v
for the values. If the hash table has multiple bindings for a
given key, all bindings are formatted, with the most recent
binding first.
val queue : 'a Fmt.t -> 'a Stdlib.Queue.t Fmt.t
queue pp_v
formats an unspecified representation of an OCaml
queue using pp_v
to format its elements, in least recently added
order.
val stack : 'a Fmt.t -> 'a Stdlib.Stack.t Fmt.t
stack pp_v
formats an unspecified representation of an OCaml
stack using pp_v
to format its elements in top to bottom order.
val field : ?label:string Fmt.t -> string -> ('b -> 'a) -> 'a Fmt.t -> 'b Fmt.t
field ~label l prj pp_v
pretty prints a named field using label
(defaults to styled `Yellow string
) for the label, and using prj pp_v
for the field value.
val record : 'a Fmt.t list -> 'a Fmt.t
record fields
pretty-prints a value using the concatenation of
fields
, separated by ";@,"
, framed in a vertical
box and surrounded by Fmt.braces
.
These are akin to Fmt.Dump.iter
and Fmt.Dump.iter_bindings
but
delimit the sequences with Fmt.parens
.
val iter : (('a -> unit) -> 'b -> unit) -> 'b Fmt.t -> 'a Fmt.t -> 'b Fmt.t
iter iter pp_name pp_elt
formats an unspecified representation
of the iterations of iter
over a value using pp_elt
. The
iteration is named by pp_name
.
val iter_bindings : (('a -> 'b -> unit) -> 'c -> unit) ->
'c Fmt.t -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t
iter_bindings ~sep iter pp_name pp_k pp_v
formats an
unspecified representation of the iterations of iter
over a
value using pp_k
and pp_v
. The iteration is named by
pp_name
.