summaryrefslogtreecommitdiff
path: root/demo/metaform.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-10-23 14:03:12 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-10-23 14:03:12 -0400
commita2495d384c7747a079cb0f4bc31f44d626391068 (patch)
tree65ced70d644fa88a41a2270c9e5351cca303914c /demo/metaform.ur
parent0fa422bfaf3931aacff958cb73d44ebfa4191f4a (diff)
Metaform demos, minus prose
Diffstat (limited to 'demo/metaform.ur')
-rw-r--r--demo/metaform.ur28
1 files changed, 28 insertions, 0 deletions
diff --git a/demo/metaform.ur b/demo/metaform.ur
new file mode 100644
index 00000000..ae1197f4
--- /dev/null
+++ b/demo/metaform.ur
@@ -0,0 +1,28 @@
+functor Make (M : sig
+ con fs :: {Unit}
+ val names : $(mapUT string fs)
+ end) = struct
+
+ fun handler values = return <xml><body>
+ {foldURX2 [string] [string] [body]
+ (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] name value => <xml>
+ <li> {[name]} = {[value]}</li>
+ </xml>)
+ [M.fs] M.names values}
+ </body></xml>
+
+ fun main () = return <xml><body>
+ <form>
+ {foldUR [string] [fn cols :: {Unit} => xml form [] (mapUT string cols)]
+ (fn (nm :: Name) (rest :: {Unit}) [[nm] ~ rest] name
+ (acc : xml form [] (mapUT string rest)) => <xml>
+ <li> {[name]}: <textbox{nm}/></li>
+ {useMore acc}
+ </xml>)
+ <xml/>
+ [M.fs] M.names}
+ <submit action={handler}/>
+ </form>
+ </body></xml>
+
+end