Up – base » Base__ » Pretty_printerModule Base__.Pretty_printer
A list of pretty printers for various types, for use in toplevels.
Pretty_printer
has a string list ref
with the names of pp
functions matching the interface:
val pp : Format.formatter -> t -> unit
The names are actually OCaml identifier names, e.g., "Base.Int.pp". Code for building toplevels (this code is not in Base) evaluates the strings to yield the pretty printers and register them with the OCaml runtime.
val all : unit -> string list
all ()
returns all pretty printers that have been register
ed.
module type S = sig ... end
Modules that provide a pretty printer will match S
.
module Register : functor (M : sig ... end ) -> S with type t := M.t
Register
builds a pp
function from a to_string
function, and adds the module_name ^ ".pp"
to the list of pretty printers. The idea is to statically guarantee that one has the desired pp
function at the same point where the name
is added.
module Register_pp : functor (M : sig ... end ) -> S with type t := M.t
Register_pp
is like Register
, but allows a custom pp
function rather than using to_string
.
val register : string -> unit
register name
adds name
to the list of pretty printers. Use the Register
functor if possible.