Module Tpf_fmt

Generic printers.

This modules depends on fmt.

Generic printer

type sum = string -> unit Fmt.t list Fmt.t

sum name args formats a variant with constructor name and argument formatters args.

type record = string option -> (string * unit Fmt.t) list Fmt.t

record None fields formats a plain constructorless record; record (Some name) fields formats an inline record with constructor name. args are argument formatters paired with field names.

include Tpf.P with type 'a q := 'a Fmt.t
type 'a q

Query type.

type p

q proxy.

val (!) : 'a q -> ('ap) Tpf.app

Injection.

val g_pp : ?⁠sum:sum -> ?⁠record:record -> ('ap) Tpf.view -> 'a Fmt.t

g_pp ~sum ~record v ppf x uses v to view x and pretty-print it on ppf.

sum controls the formatting of plain variants, record of records. Defaults match the way toplevel prints values.

data interface

val data0 : ?⁠sum:sum -> ?⁠record:record -> 'a Tpf.data0 -> 'a Fmt.t
val data1 : ?⁠sum:sum -> ?⁠record:record -> ('a'b) Tpf.data1 -> 'a Fmt.t -> 'b Fmt.t
val data2 : ?⁠sum:sum -> ?⁠record:record -> ('a'b'c) Tpf.data2 -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t
val data3 : ?⁠sum:sum -> ?⁠record:record -> ('a'b'c'd) Tpf.data3 -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t -> 'd Fmt.t
val data4 : ?⁠sum:sum -> ?⁠record:record -> ('a'b'c'd'e) Tpf.data4 -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t -> 'd Fmt.t -> 'e Fmt.t
val data5 : ?⁠sum:sum -> ?⁠record:record -> ('a'b'c'd'e'f) Tpf.data5 -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t -> 'd Fmt.t -> 'e Fmt.t -> 'f Fmt.t
val data6 : ?⁠sum:sum -> ?⁠record:record -> ('a'b'c'd'e'f'g) Tpf.data6 -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t -> 'd Fmt.t -> 'e Fmt.t -> 'f Fmt.t -> 'g Fmt.t
val data7 : ?⁠sum:sum -> ?⁠record:record -> ('a'b'c'd'e'f'g'h) Tpf.data7 -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t -> 'd Fmt.t -> 'e Fmt.t -> 'f Fmt.t -> 'g Fmt.t -> 'h Fmt.t
val data8 : ?⁠sum:sum -> ?⁠record:record -> ('a'b'c'd'e'f'g'h'i) Tpf.data8 -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t -> 'd Fmt.t -> 'e Fmt.t -> 'f Fmt.t -> 'g Fmt.t -> 'h Fmt.t -> 'i Fmt.t
val data9 : ?⁠sum:sum -> ?⁠record:record -> ('a'b'c'd'e'f'g'h'i'j) Tpf.data9 -> 'a Fmt.t -> 'b Fmt.t -> 'c Fmt.t -> 'd Fmt.t -> 'e Fmt.t -> 'f Fmt.t -> 'g Fmt.t -> 'h Fmt.t -> 'i Fmt.t -> 'j Fmt.t