diff demo/more/meta.ur @ 1008:1911e84df461

Move stuff from bulkEdit to meta
author Adam Chlipala <adamc@hcoop.net>
date Thu, 22 Oct 2009 11:51:31 -0400
parents d3af9e54c828
children 59097824f19b
line wrap: on
line diff
--- a/demo/more/meta.ur	Thu Oct 22 11:37:58 2009 -0400
+++ b/demo/more/meta.ur	Thu Oct 22 11:51:31 2009 -0400
@@ -44,3 +44,20 @@
                            </xml>)
           <xml/>
           [_] fl r
+
+fun allPopulatedTr [ts ::: {(Type * Type)}] (r : $(map meta ts)) (vs : $(map fst ts)) (fl : folder ts) =
+    foldR2 [meta] [fst] [fn cols :: {(Type * Type)} =>
+                            xml [Body, Form, Tr] [] (map snd cols)]
+           (fn [nm :: Name] [p :: (Type * Type)] [rest :: {(Type * Type)}] [[nm] ~ rest]
+                            (m : meta p) v (acc : xml [Body, Form, Tr] [] (map snd rest)) => 
+               <xml>
+                 <td>{m.WidgetPopulated [nm] v}</td>
+                 {useMore acc}
+               </xml>)
+           <xml/>
+           [_] fl r vs
+
+fun ensql [avail] [ts ::: {(Type * Type)}] (r : $(map meta ts)) (vs : $(map snd ts)) (fl : folder ts) =
+    map2 [meta] [snd] [fn ts :: (Type * Type) => sql_exp avail [] [] ts.1]
+         (fn [ts] meta v => @sql_inject meta.Inject (meta.Parse v))
+         [_] fl r vs