blob: ad49a40fd015c3faaa12bd116ea39514283980a7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
(** The JSON text-based serialization format *)
class json
val toJson : a ::: Type -> json a -> a -> string
val fromJson : a ::: Type -> json a -> string -> a
val fromJson' : a ::: Type -> json a -> string -> a * string
val mkJson : a ::: Type -> {ToJson : a -> string,
FromJson : string -> a * string} -> json a
val json_string : json string
val json_int : json int
val json_float : json float
val json_bool : json bool
val json_time : json time
val json_option : a ::: Type -> json a -> json (option a)
val json_list : a ::: Type -> json a -> json (list a)
(* By the way, time formatting follows RFC 3339, and we expose the more
* primitive formatting functions here. *)
val rfc3339_out : time -> string
val rfc3339_in : string -> time
val json_record : ts ::: {Type} -> folder ts -> $(map json ts) -> $(map (fn _ => string) ts) -> json $ts
val json_record_withOptional : ts ::: {Type} -> ots ::: {Type} -> [ts ~ ots]
=> folder ts -> $(map json ts) -> $(map (fn _ => string) ts)
-> folder ots -> $(map json ots) -> $(map (fn _ => string) ots)
-> json $(ts ++ map option ots)
val json_variant : ts ::: {Type} -> folder ts -> $(map json ts) -> $(map (fn _ => string) ts) -> json (variant ts)
val json_unit : json unit
functor Recursive (M : sig
con t :: Type -> Type
val json_t : a ::: Type -> json a -> json (t a)
end) : sig
datatype r = Rec of M.t r
val json_r : json r
end
|