@@ -16,7 +16,7 @@ open Sexplib0.Sexp_conv
16
16
17
17
module Type = struct
18
18
type t = String | Set (* * of strings *) | Pairs (* * of strings *)
19
- [@@ deriving sexp ]
19
+ [@@ deriving sexp_of ]
20
20
21
21
exception Error of t * t
22
22
@@ -38,7 +38,7 @@ module Value = struct
38
38
| String of string
39
39
| Set of string list
40
40
| Pairs of (string * string ) list
41
- [@@ deriving sexp ]
41
+ [@@ deriving sexp_of ]
42
42
43
43
let marshal = function
44
44
| String x ->
@@ -95,7 +95,7 @@ module Column = struct
95
95
; issetref : bool
96
96
(* * only so we can special case set refs in the interface *)
97
97
}
98
- [@@ deriving sexp ]
98
+ [@@ deriving sexp_of ]
99
99
100
100
let name_of t = t.name
101
101
end
@@ -109,7 +109,7 @@ let values_of_table tbl = Hashtbl.fold (fun _ v vs -> v :: vs) tbl []
109
109
110
110
module Table = struct
111
111
type t' = {name : string ; columns : Column .t list ; persistent : bool }
112
- [@@ deriving sexp ]
112
+ [@@ deriving sexp_of ]
113
113
114
114
type t = {
115
115
name : string
@@ -133,11 +133,6 @@ module Table = struct
133
133
let t' = t'_of_t t in
134
134
sexp_of_t' t'
135
135
136
- let t_of_sexp s =
137
- let ({name; columns; persistent} : t' ) = t'_of_sexp s in
138
- let columns = tabulate columns ~key_fn: Column. name_of in
139
- ({name; columns; persistent} : t )
140
-
141
136
let find name (t : t ) =
142
137
match Hashtbl. find_opt t.columns name with
143
138
| Some c ->
@@ -157,10 +152,10 @@ module Table = struct
157
152
end
158
153
159
154
type relationship = OneToMany of string * string * string * string
160
- [@@ deriving sexp ]
155
+ [@@ deriving sexp_of ]
161
156
162
157
module Database = struct
163
- type t' = {tables : Table .t list } [@@ deriving sexp ]
158
+ type t' = {tables : Table .t list } [@@ deriving sexp_of ]
164
159
165
160
type t = {tables : (string , Table .t ) Hashtbl .t }
166
161
@@ -180,10 +175,6 @@ module Database = struct
180
175
let t' = t'_of_t t in
181
176
sexp_of_t' t'
182
177
183
- let t_of_sexp s =
184
- let t' = t'_of_sexp s in
185
- t_of_t' t'
186
-
187
178
let find name t =
188
179
match Hashtbl. find_opt t.tables name with
189
180
| Some tbl ->
@@ -197,7 +188,7 @@ module Database = struct
197
188
end
198
189
199
190
(* * indexed by table name, a list of (this field, foreign table, foreign field) *)
200
- type foreign = (string * string * string ) list [@@ deriving sexp ]
191
+ type foreign = (string * string * string ) list [@@ deriving sexp_of ]
201
192
202
193
module ForeignMap = struct
203
194
include Map. Make (struct
@@ -206,17 +197,13 @@ module ForeignMap = struct
206
197
let compare = Stdlib. compare
207
198
end )
208
199
209
- type t' = (string * foreign ) list [@@ deriving sexp ]
200
+ type t' = (string * foreign ) list [@@ deriving sexp_of ]
210
201
211
202
type m = foreign t
212
203
213
204
let sexp_of_m t : Sexp.t =
214
205
let t' = fold (fun key foreign acc -> (key, foreign) :: acc) t [] in
215
206
sexp_of_t' t'
216
-
217
- let m_of_sexp sexp : m =
218
- let t' = t'_of_sexp sexp in
219
- List. fold_left (fun acc (key , foreign ) -> add key foreign acc) empty t'
220
207
end
221
208
222
209
type t = {
@@ -227,7 +214,7 @@ type t = {
227
214
; one_to_many : ForeignMap .m
228
215
; many_to_many : ForeignMap .m
229
216
}
230
- [@@ deriving sexp ]
217
+ [@@ deriving sexp_of ]
231
218
232
219
let database x = x.database
233
220
0 commit comments