diff demo/more/dbgrid.urs @ 930:51bc7681c47e

Nullable columns *might* be working, but too much JS is generated for the page to load in finite time
author Adam Chlipala <adamc@hcoop.net>
date Sat, 12 Sep 2009 15:08:16 -0400
parents 5e8b6fa5b48f
children 2422360c78a3
line wrap: on
line diff
--- a/demo/more/dbgrid.urs	Sat Sep 12 10:36:17 2009 -0400
+++ b/demo/more/dbgrid.urs	Sat Sep 12 15:08:16 2009 -0400
@@ -15,13 +15,20 @@
                   Handlers : global_t.1 -> colMeta' row global_t.2}
 
 structure Direct : sig
+    con metaBase = fn actual_input :: (Type * Type) =>
+                  {Display : actual_input.2 -> xbody,
+                   Edit : actual_input.2 -> xbody,
+                   Initialize : actual_input.1 -> transaction actual_input.2,
+                   Parse : actual_input.2 -> signal (option actual_input.1)}
+
+    datatype metaBoth actual input =
+             NonNull of metaBase (actual, input) * metaBase (option actual, input)
+           | Nullable of metaBase (actual, input)
+
     con meta = fn global_actual_input :: (Type * Type * Type) =>
                   {Initialize : transaction global_actual_input.1,
                    Handlers : global_actual_input.1
-                              -> {Display : global_actual_input.3 -> xbody,
-                                  Edit : global_actual_input.3 -> xbody,
-                                  Initialize : global_actual_input.2 -> transaction global_actual_input.3,
-                                  Parse : global_actual_input.3 -> signal (option global_actual_input.2)}}
+                              -> metaBoth global_actual_input.2 global_actual_input.3}
 
     con editableState :: (Type * Type * Type) -> (Type * Type)
     val editable : ts ::: (Type * Type * Type) -> rest ::: {Type}
@@ -35,6 +42,10 @@
                                                      -> colMeta ([nm = ts.2] ++ rest)
                                                                 (readOnlyState ts)
 
+    val nullable : global ::: Type -> actual ::: Type -> input ::: Type
+                   -> meta (global, actual, input)
+                   -> meta (global, option actual, input)
+
     type intGlobal
     type intInput
     val int : meta (intGlobal, int, intInput)