diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-10-05 16:36:38 -0400 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-10-05 16:36:38 -0400 |
commit | caf2eebe290285171244d67ef24d1fc56d1f8fd7 (patch) | |
tree | 4bb99b24aa10939567424dd11c6c414094f8fe4f /demo/more/orm.ur | |
parent | 280383cc8e3ac593d57ae26097a7b972edb2ea7a (diff) |
Better location calculation for record unification error messages; infer kind arguments to module-projected variables
Diffstat (limited to 'demo/more/orm.ur')
-rw-r--r-- | demo/more/orm.ur | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/demo/more/orm.ur b/demo/more/orm.ur new file mode 100644 index 00000000..9abc0234 --- /dev/null +++ b/demo/more/orm.ur @@ -0,0 +1,29 @@ +con link = fn t :: Type => unit + +con meta = fn col :: Type => { + Link : link col, + Inj : sql_injectable col + } + +functor Table(M : sig + con cols :: {Type} + val cols : $(map meta cols) + constraint [Id] ~ cols + val folder : folder cols + end) = struct + type id = int + val inj = _ + val id : meta id = {Link = (), + Inj = inj} + + sequence s + table t : ([Id = id] ++ M.cols) + + fun create (r : $M.cols) = + id <- nextval s; + dml (insert t ({Id = sql_inject id} + ++ map2 [meta] [Top.id] [sql_exp [] [] []] + (fn [t ::: Type] (meta : meta t) (v : t) => @sql_inject meta.Inj v) + [_] M.folder M.cols r)); + return id +end |