Mercurial > urweb
changeset 935:2422360c78a3
Dropped in initial aggregate types
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Tue, 15 Sep 2009 09:40:51 -0400 |
parents | 36f787c02287 |
children | 6966d98c80b5 |
files | demo/more/dbgrid.ur demo/more/dbgrid.urs demo/more/grid.ur demo/more/grid.urs demo/more/grid1.ur |
diffstat | 5 files changed, 36 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/demo/more/dbgrid.ur Mon Sep 14 19:04:38 2009 -0400 +++ b/demo/more/dbgrid.ur Tue Sep 15 09:40:51 2009 -0400 @@ -14,6 +14,11 @@ {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 @@ 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 @@ val cols = M.cols val folder = M.colsFolder + + val aggregates = M.aggregates end) end
--- a/demo/more/dbgrid.urs Mon Sep 14 19:04:38 2009 -0400 +++ b/demo/more/dbgrid.urs Tue Sep 15 09:40:51 2009 -0400 @@ -14,6 +14,11 @@ {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 @@ 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
--- a/demo/more/grid.ur Mon Sep 14 19:04:38 2009 -0400 +++ b/demo/more/grid.ur Tue Sep 15 09:40:51 2009 -0400 @@ -10,6 +10,11 @@ {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 @@ 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
--- a/demo/more/grid.urs Mon Sep 14 19:04:38 2009 -0400 +++ b/demo/more/grid.urs Tue Sep 15 09:40:51 2009 -0400 @@ -10,6 +10,11 @@ {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 @@ val cols : $(map (colMeta row) cols) val folder : folder cols + + con aggregates :: {Type} + val aggregates : $(map (aggregateMeta row) aggregates) end) : sig type grid
--- a/demo/more/grid1.ur Mon Sep 14 19:04:38 2009 -0400 +++ b/demo/more/grid1.ur Tue Sep 15 09:40:51 2009 -0400 @@ -44,6 +44,8 @@ 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 () =