Module Tpf_json.Enc
Generic JSON encoder.
Records are represented as JSON objects, and constant constructors are represented as JSON strings.
The representation of variants is determined by the ~sum argument (default arr).
Generic function
type sum= string -> json list -> jsonSum-formatting functions.
f name argsis the JSON encoding of constructor namedname, with argumentsargs.
val arr : sumFormats
K (a0, a1, ...)as["K", a0, a1, ...].
val obj : ?tag:string -> ?values:string -> sumFormats
K (a0, a1, ...)as{ tag: "K", values: [a0, a1, ...]}.tagdefaults to"tag"andvaluesdefaults to"values".
data interface
val data0 : ?sum:sum -> 'x Tpf.data0 -> 'x eval data1 : ?sum:sum -> ('a, 'x) Tpf.data1 -> 'a e -> 'x eval data2 : ?sum:sum -> ('a, 'b, 'x) Tpf.data2 -> 'a e -> 'b e -> 'x eval data3 : ?sum:sum -> ('a, 'b, 'c, 'x) Tpf.data3 -> 'a e -> 'b e -> 'c e -> 'x eval data4 : ?sum:sum -> ('a, 'b, 'c, 'd, 'x) Tpf.data4 -> 'a e -> 'b e -> 'c e -> 'd e -> 'x eval data5 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'x) Tpf.data5 -> 'a e -> 'b e -> 'c e -> 'd e -> 'e e -> 'x eval data6 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'f, 'x) Tpf.data6 -> 'a e -> 'b e -> 'c e -> 'd e -> 'e e -> 'f e -> 'x eval data7 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'x) Tpf.data7 -> 'a e -> 'b e -> 'c e -> 'd e -> 'e e -> 'f e -> 'g e -> 'x eval data8 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'x) Tpf.data8 -> 'a e -> 'b e -> 'c e -> 'd e -> 'e e -> 'f e -> 'g e -> 'h e -> 'x eval data9 : ?sum:sum -> ('a, 'b, 'c, 'd, 'e, 'f, 'g, 'h, 'i, 'x) Tpf.data9 -> 'a e -> 'b e -> 'c e -> 'd e -> 'e e -> 'f e -> 'g e -> 'h e -> 'i e -> 'x e