annotate json.urs @ 6:799f43bce62b
Import some code from iwl
author |
Adam Chlipala <adam@chlipala.net> |
date |
Tue, 14 Dec 2010 10:33:24 -0500 |
parents |
943410267fad |
children |
8de201d70b91 |
rev |
line source |
adam@5
|
1 (** The JSON text-based serialization format *)
|
adam@5
|
2
|
adam@0
|
3 class json
|
adam@0
|
4
|
adam@0
|
5 val toJson : a ::: Type -> json a -> a -> string
|
adam@0
|
6 val fromJson : a ::: Type -> json a -> string -> a
|
adam@0
|
7
|
adam@0
|
8 val mkJson : a ::: Type -> {ToJson : a -> string,
|
adam@0
|
9 FromJson : string -> a * string} -> json a
|
adam@0
|
10
|
adam@0
|
11 val json_string : json string
|
adam@0
|
12 val json_int : json int
|
adam@0
|
13 val json_float : json float
|
adam@0
|
14 val json_bool : json bool
|
adam@4
|
15 val json_option : a ::: Type -> json a -> json (option a)
|
adam@0
|
16 val json_list : a ::: Type -> json a -> json (list a)
|
adam@1
|
17
|
adam@1
|
18 val json_record : ts ::: {Type} -> folder ts -> $(map json ts) -> $(map (fn _ => string) ts) -> json $ts
|