Module IStdlib.Pp

module F = Stdlib.Format

Pretty Printing

type color =
  1. | Black
  2. | Blue
  3. | Green
  4. | Orange
  5. | Red

Colors supported in printing

val compare_color : color -> color -> int
val equal_color : color -> color -> bool
type colormap = Stdlib.Obj.t -> color

map subexpressions (as Obj.t element compared by physical equality) to colors

type simple_kind =
  1. | SIM_DEFAULT
  2. | SIM_WITH_TYP

Kind of simple printing: default or with full types

type print_kind =
  1. | TEXT
  2. | HTML

Kind of printing

val compare_print_kind : print_kind -> print_kind -> int
val equal_print_kind : print_kind -> print_kind -> bool
type env = {
  1. opt : simple_kind;
    (*

    Current option for simple printing

    *)
  2. kind : print_kind;
    (*

    Current kind of printing

    *)
  3. break_lines : bool;
    (*

    whether to let Format add its own line breaks or not (false by default)

    *)
  4. cmap_norm : colormap;
    (*

    Current colormap for the normal part

    *)
  5. cmap_foot : colormap;
    (*

    Current colormap for the footprint part

    *)
  6. color : color;
    (*

    Current color

    *)
  7. obj_sub : (Stdlib.Obj.t -> Stdlib.Obj.t) option;
    (*

    generic object substitution

    *)
}

Print environment threaded through all the printing functions

val reset_obj_sub : env -> env

Reset the object substitution, so that no substitution takes place

val set_obj_sub : env -> ('a -> 'a) -> env

Set the object substitution, which is supposed to preserve the type. Currently only used for a map from (identifier) expressions to the program var containing them

val extend_colormap : env -> Stdlib.Obj.t -> color -> env

Extend the normal colormap for the given object with the given color

val color_wrapper : env -> F.formatter -> 'a -> f:(env -> F.formatter -> 'a -> unit) -> unit
val text : env

Default text print environment

val text_break : env

text print environment that allows line breaks

val html : color -> env

Default html print environment

val color_string : color -> string

string representation of colors

val html_with_color : color -> (F.formatter -> 'a -> unit) -> F.formatter -> 'a -> unit
val html_collapsible_block : name:string -> (F.formatter -> 'a -> unit) -> F.formatter -> 'a -> unit

Output the value in a named summary-details block. Both the name and the result of inner pretty-printer will be escaped.

val option : (F.formatter -> 'a -> unit) -> F.formatter -> 'a option -> unit
val cli_args : F.formatter -> string list -> unit

pretty print command line arguments, expanding argument files to print their contents

val cli_args_with_verbosity : verbose:bool -> F.formatter -> string list -> unit

pretty print command line arguments, and expand argument files if verbose is true

val seq : ?print_env:env -> ?sep:string -> ?sep_html:string -> (F.formatter -> 'a -> unit) -> F.formatter -> 'a list -> unit

Pretty print a sequence with sep followed by a space between each element. By default, print_env is text, sep is "", and sep_html set to sep.

val comma_seq : ?print_env:env -> (F.formatter -> 'a -> unit) -> F.formatter -> 'a list -> unit

Pretty print a comma-separated sequence.

val comma_seq_diff : (F.formatter -> 'a -> unit) -> env -> F.formatter -> 'a list -> unit
val semicolon_seq : ?print_env:env -> (F.formatter -> 'a -> unit) -> F.formatter -> 'a list -> unit

Pretty print a ;-separated sequence

val of_string : f:('a -> string) -> F.formatter -> 'a -> unit

If all you have is to_string, but you need pp_foo.

val string_of_pp : (F.formatter -> 'a -> unit) -> 'a -> string

If all you have is pp_foo, but you need to_string.

val pair : fst:(F.formatter -> 'a -> unit) -> snd:(F.formatter -> 'b -> unit) -> F.formatter -> ('a * 'b) -> unit
val in_backticks : (F.formatter -> 'a -> unit) -> F.formatter -> 'a -> unit
val collection : fold:('t, 'item, bool) IStdlib.IStd.Container.fold -> sep:string -> pp_item:(F.formatter -> 'item -> unit) -> F.formatter -> 't -> unit