Module Assemblage.Fmt

module Fmt: sig .. end
Formatters.


Formatters


type 'a formatter = Format.formatter -> 'a -> unit 
The type for formatters of values of type 'a.
val pp : Format.formatter -> ('a, Format.formatter, unit) Pervasives.format -> 'a
pp is Format.fprintf
val rpp : ('a, Format.formatter, unit) Pervasives.format -> Format.formatter -> 'a
rpp is pp fmt ppf
val nop : 'a formatter
nop does nothing.
val pp_cut : unit formatter
pp_cut is Format.pp_print_cut.
val pp_sp : unit formatter
pp_sp is Format.pp_print_space.
val pp_str : string formatter
pp_str is Format.pp_print_string.
val pp_int : int formatter
pp_int is Format.pp_print_int.
val pp_bool : bool formatter
pp_bool is Format.pp_print_bool.
val pp_larrow : unit formatter
pp_larrow formats a left arrow.
val pp_rarrow : unit formatter
pp_rarrow formats a right arrow.
val pp_opt : ?pp_none:unit formatter ->
'a formatter -> 'a option formatter
pp_opt pp_none pp_v formats value of type 'a option. The default value of pp_none prints nothing.
val pp_list : ?pp_sep:unit formatter ->
'a formatter -> 'a list formatter
pp_list pp_sep pp_v formats lists of type 'a. Each value is printed with pp_v followed by pp_sep (defaults to Assemblage.Fmt.pp_cut). Empty lists never print anything.
val pp_text : string formatter
pp_text formats text by replacing spaces and newlines in the string with calls to Format.pp_print_space and Format.pp_force_newline.
val pp_lines : string formatter
pp_lines formats lines by replacing newlines in the string with calls to Format.pp_force_newline.
val pp_doomed : string formatter
pp_doomed should be used for printing a message when reasonable assumptions are being violated. The string should be a short description of what is going on.

Conditional UTF-8 formatting

Note. Since Format is not UTF-8 aware using UTF-8 output may derail the pretty printing process. The decision of allowing UTF-8 is left to the discretion of the drivers.

val pp_if_utf8 : 'a formatter ->
'a formatter -> 'a formatter
pp_if_utf8 pp_u pp is a formatter that will use pp_u if UTF-8 output is enabled by the driver and pp otherwise.

Styled formatting

Note. Text output using these functions may still appear unformatted, style application is left to the discretion of drivers.

type style = [ `Black
| `Blue
| `Bold
| `Cyan
| `Green
| `Magenta
| `None
| `Red
| `Underline
| `White
| `Yellow ]
The type for styles.
val pp_styled : style ->
'a formatter -> 'a formatter
pp_styled style pp formats according to pp but styled with style.
val pp_styled_str : style -> string formatter
pp_styled_str style is pp_styled_str style pp_str.