summaryrefslogtreecommitdiff
path: root/demo/more
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-09-15 09:40:51 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-09-15 09:40:51 -0400
commit89ff99b8cb398180ae3168dec72baa793fe42850 (patch)
tree433c0110e44492d0f49fe446996e8d66d8cefd7d /demo/more
parent805b4913fe374d10f9a9ef4f7f8a79a8e25c4601 (diff)
Dropped in initial aggregate types
Diffstat (limited to 'demo/more')
-rw-r--r--demo/more/dbgrid.ur10
-rw-r--r--demo/more/dbgrid.urs8
-rw-r--r--demo/more/grid.ur8
-rw-r--r--demo/more/grid.urs8
-rw-r--r--demo/more/grid1.ur2
5 files changed, 36 insertions, 0 deletions
diff --git a/demo/more/dbgrid.ur b/demo/more/dbgrid.ur
index 15dfb857..e25396df 100644
--- a/demo/more/dbgrid.ur
+++ b/demo/more/dbgrid.ur
@@ -14,6 +14,11 @@ con colMeta = fn (row :: {Type}) (global_t :: (Type * Type)) =>
{Initialize : transaction global_t.1,
Handlers : global_t.1 -> colMeta' row global_t.2}
+con aggregateMeta = fn (row :: {Type}) (acc :: Type) =>
+ {Initial : acc,
+ Step : $row -> acc -> acc,
+ Display : acc -> xbody}
+
structure Direct = struct
con metaBase = fn actual_input :: (Type * Type) =>
{Display : actual_input.2 -> xbody,
@@ -243,6 +248,9 @@ functor Make(M : sig
val keyFolder : folder key
val rowFolder : folder row
val colsFolder : folder cols
+
+ con aggregates :: {Type}
+ val aggregates : $(map (aggregateMeta (key ++ row)) aggregates)
end) = struct
open Grid.Make(struct
val list = query (SELECT * FROM {{M.tab}} AS T) (fn r rs => return (r.T :: rs)) []
@@ -285,5 +293,7 @@ functor Make(M : sig
val cols = M.cols
val folder = M.colsFolder
+
+ val aggregates = M.aggregates
end)
end
diff --git a/demo/more/dbgrid.urs b/demo/more/dbgrid.urs
index cfbdff89..908f4b2a 100644
--- a/demo/more/dbgrid.urs
+++ b/demo/more/dbgrid.urs
@@ -14,6 +14,11 @@ con colMeta = fn (row :: {Type}) (global_t :: (Type * Type)) =>
{Initialize : transaction global_t.1,
Handlers : global_t.1 -> colMeta' row global_t.2}
+con aggregateMeta = fn (row :: {Type}) (acc :: Type) =>
+ {Initial : acc,
+ Step : $row -> acc -> acc,
+ Display : acc -> xbody}
+
structure Direct : sig
con metaBase = fn actual_input :: (Type * Type) =>
{Display : actual_input.2 -> xbody,
@@ -95,6 +100,9 @@ functor Make(M : sig
val keyFolder : folder key
val rowFolder : folder row
val colsFolder : folder cols
+
+ con aggregates :: {Type}
+ val aggregates : $(map (aggregateMeta (key ++ row)) aggregates)
end) : sig
type grid
diff --git a/demo/more/grid.ur b/demo/more/grid.ur
index e09a1ef0..084ddefc 100644
--- a/demo/more/grid.ur
+++ b/demo/more/grid.ur
@@ -10,6 +10,11 @@ con colMeta = fn (row :: Type) (global_t :: (Type * Type)) =>
{Initialize : transaction global_t.1,
Handlers : global_t.1 -> colMeta' row global_t.2}
+con aggregateMeta = fn (row :: Type) (acc :: Type) =>
+ {Initial : acc,
+ Step : row -> acc -> acc,
+ Display : acc -> xbody}
+
functor Make(M : sig
type row
val list : transaction (list row)
@@ -21,6 +26,9 @@ functor Make(M : sig
val cols : $(map (colMeta row) cols)
val folder : folder cols
+
+ con aggregates :: {Type}
+ val aggregates : $(map (aggregateMeta row) aggregates)
end) = struct
style tabl
style tr
diff --git a/demo/more/grid.urs b/demo/more/grid.urs
index 191ec49a..6942d38e 100644
--- a/demo/more/grid.urs
+++ b/demo/more/grid.urs
@@ -10,6 +10,11 @@ con colMeta = fn (row :: Type) (global_t :: (Type * Type)) =>
{Initialize : transaction global_t.1,
Handlers : global_t.1 -> colMeta' row global_t.2}
+con aggregateMeta = fn (row :: Type) (acc :: Type) =>
+ {Initial : acc,
+ Step : row -> acc -> acc,
+ Display : acc -> xbody}
+
functor Make(M : sig
type row
val list : transaction (list row)
@@ -21,6 +26,9 @@ functor Make(M : sig
val cols : $(map (colMeta row) cols)
val folder : folder cols
+
+ con aggregates :: {Type}
+ val aggregates : $(map (aggregateMeta row) aggregates)
end) : sig
type grid
diff --git a/demo/more/grid1.ur b/demo/more/grid1.ur
index b5cc4511..829cf052 100644
--- a/demo/more/grid1.ur
+++ b/demo/more/grid1.ur
@@ -44,6 +44,8 @@ open Make(struct
F = Direct.editable [#F] ! "F" (Direct.nullable F.meta),
DA = computed "2A" (fn r => 2 * r.A),
Link = computedHtml "Link" (fn r => <xml><a link={page (r.A, r.B)}>Go</a></xml>)}
+
+ val aggregates = {}
end)
fun main () =