comparison demo/more/orm.ur @ 987:6dd122f10c0c

Better location calculation for record unification error messages; infer kind arguments to module-projected variables
author Adam Chlipala <adamc@hcoop.net>
date Mon, 05 Oct 2009 16:36:38 -0400
parents
children d923b47e483d
comparison
equal deleted inserted replaced
986:d1dbb9a3c804 987:6dd122f10c0c
1 con link = fn t :: Type => unit
2
3 con meta = fn col :: Type => {
4 Link : link col,
5 Inj : sql_injectable col
6 }
7
8 functor Table(M : sig
9 con cols :: {Type}
10 val cols : $(map meta cols)
11 constraint [Id] ~ cols
12 val folder : folder cols
13 end) = struct
14 type id = int
15 val inj = _
16 val id : meta id = {Link = (),
17 Inj = inj}
18
19 sequence s
20 table t : ([Id = id] ++ M.cols)
21
22 fun create (r : $M.cols) =
23 id <- nextval s;
24 dml (insert t ({Id = sql_inject id}
25 ++ map2 [meta] [Top.id] [sql_exp [] [] []]
26 (fn [t ::: Type] (meta : meta t) (v : t) => @sql_inject meta.Inj v)
27 [_] M.folder M.cols r));
28 return id
29 end