From 78e557c3b405113b62bc945382415895860a5825 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Mon, 5 Oct 2009 16:36:38 -0400 Subject: Better location calculation for record unification error messages; infer kind arguments to module-projected variables --- demo/more/orm.ur | 29 +++++++++++++++++++++++++++++ demo/more/orm.urp | 2 ++ demo/more/orm.urs | 19 +++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 demo/more/orm.ur create mode 100644 demo/more/orm.urp create mode 100644 demo/more/orm.urs (limited to 'demo') 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 diff --git a/demo/more/orm.urp b/demo/more/orm.urp new file mode 100644 index 00000000..7380983a --- /dev/null +++ b/demo/more/orm.urp @@ -0,0 +1,2 @@ + +orm diff --git a/demo/more/orm.urs b/demo/more/orm.urs new file mode 100644 index 00000000..8fab3ae8 --- /dev/null +++ b/demo/more/orm.urs @@ -0,0 +1,19 @@ +con link :: Type -> Type + +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) : sig + type id + val inj : sql_injectable id + val id : meta id + + val create : $M.cols -> transaction id +end -- cgit v1.2.3