comparison demo/more/grid.ur @ 1304:f0afe61a6f8b

Tweaking unification fix to apply to demo/more
author Adam Chlipala <adam@chlipala.net>
date Sun, 10 Oct 2010 15:37:14 -0400
parents ad15700272f6
children 78fe9841c39d
comparison
equal deleted inserted replaced
1303:c7b9a33c26c8 1304:f0afe61a6f8b
47 style agg 47 style agg
48 48
49 fun make (row : M.row) [input] [filter] (m : colMeta' M.row input filter) : transaction input = m.Project row 49 fun make (row : M.row) [input] [filter] (m : colMeta' M.row input filter) : transaction input = m.Project row
50 50
51 fun makeAll cols row = @@Monad.exec [transaction] _ [map snd3 M.cols] 51 fun makeAll cols row = @@Monad.exec [transaction] _ [map snd3 M.cols]
52 (@map2 [fst3] [colMeta M.row] [fn p => transaction (snd3 p)] 52 (@map2 [fst3] [colMeta M.row] [fn p => transaction (snd3 p)]
53 (fn [p] data meta => make row(meta.Handlers data)) 53 (fn [p] data meta => make row (meta.Handlers data))
54 M.folder cols M.cols) 54 M.folder cols M.cols)
55 (@@Folder.mp [_] [_] M.folder) 55 (@@Folder.mp [_] [_] M.folder)
56
57 type listT = {Row : source M.row,
58 Cols : source ($(map snd3 M.cols)),
59 Updating : source bool,
60 Selected : source bool}
56 61
57 type grid = {Cols : $(map fst3 M.cols), 62 type grid = {Cols : $(map fst3 M.cols),
58 Rows : Dlist.dlist {Row : source M.row, 63 Rows : Dlist.dlist listT,
59 Cols : source ($(map snd3 M.cols)),
60 Updating : source bool,
61 Selected : source bool},
62 Selection : source bool, 64 Selection : source bool,
63 Filters : $(map thd3 M.cols), 65 Filters : $(map thd3 M.cols),
64 Sort : source (option (M.row -> M.row -> bool)), 66 Sort : source (option (M.row -> M.row -> bool)),
65 Position : source int} 67 Position : source int}
66 68
248 return (Option.mp (fn f r1 r2 => r1 <- signal r1.Row; 250 return (Option.mp (fn f r1 r2 => r1 <- signal r1.Row;
249 r2 <- signal r2.Row; 251 r2 <- signal r2.Row;
250 return (f r1 r2)) f)} 252 return (f r1 r2)) f)}
251 grid.Rows} 253 grid.Rows}
252 254
253 <dyn signal={rows <- Dlist.foldl (fn row => @Monad.mapR2 _ [aggregateMeta M.row] [id] [id] 255 <dyn signal={rows <- Dlist.foldl (fn row : listT =>
254 (fn [nm :: Name] [t :: Type] meta acc => 256 @Monad.mapR2 _ [aggregateMeta M.row] [id] [id]
255 Monad.mp (fn v => meta.Step v acc) 257 (fn [nm :: Name] [t :: Type] meta acc =>
256 (signal row.Row)) 258 Monad.mp (fn v => meta.Step v acc)
257 M.aggFolder M.aggregates) 259 (signal row.Row))
260 M.aggFolder M.aggregates)
258 (@mp [aggregateMeta M.row] [id] 261 (@mp [aggregateMeta M.row] [id]
259 (fn [t] meta => meta.Initial) 262 (fn [t] meta => meta.Initial)
260 M.aggFolder M.aggregates) grid.Rows; 263 M.aggFolder M.aggregates) grid.Rows;
261 return <xml><tr> 264 return <xml><tr>
262 <th colspan={3}>Aggregates</th> 265 <th colspan={3}>Aggregates</th>