diff demo/more/grid.ur @ 936:6966d98c80b5

Include 'key' type in Grid
author Adam Chlipala <adamc@hcoop.net>
date Tue, 15 Sep 2009 09:45:46 -0400
parents 2422360c78a3
children 37dd42935dad
line wrap: on
line diff
--- a/demo/more/grid.ur	Tue Sep 15 09:40:51 2009 -0400
+++ b/demo/more/grid.ur	Tue Sep 15 09:45:46 2009 -0400
@@ -17,10 +17,13 @@
 
 functor Make(M : sig
                  type row
+                 type key
+                 val keyOf : row -> key
+
                  val list : transaction (list row)
                  val new : transaction row
-                 val save : {Old : row, New : row} -> transaction unit
-                 val delete : row -> transaction unit
+                 val save : key -> row -> transaction unit
+                 val delete : key -> transaction unit
 
                  con cols :: {(Type * Type)}
                  val cols : $(map (colMeta row) cols)
@@ -85,7 +88,7 @@
                                 val delete =
                                     Dlist.delete pos;
                                     row <- get rowS;
-                                    rpc (M.delete row)
+                                    rpc (M.delete (M.keyOf row))
 
                                 val update = set ud True
 
@@ -122,7 +125,7 @@
                                                                               [[nm] ~ rest] data meta v row' =>
                                                                  (meta.Handlers data).Update row' v)
                                                              row [_] M.folder grid.Cols M.cols cols;
-                                        rpc (M.save {Old = row, New = row'});
+                                        rpc (M.save (M.keyOf row) row');
                                         set rowS row';
 
                                         cols <- makeAll grid.Cols row';