summaryrefslogtreecommitdiff
path: root/tests/gform.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 08:32:18 -0400
committerGravatar Adam Chlipala <adamc@hcoop.net>2008-08-31 08:32:18 -0400
commit447b60afccc89ef18d8f92a260dd1fcdf735898e (patch)
tree93d1ffca9832084286525896afc4c17eaf5d23f4 /tests/gform.ur
parent508290e29047e068b9db4b02485fefd9e3ced81c (diff)
Laconic -> Ur
Diffstat (limited to 'tests/gform.ur')
-rw-r--r--tests/gform.ur46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/gform.ur b/tests/gform.ur
new file mode 100644
index 00000000..e1b194c0
--- /dev/null
+++ b/tests/gform.ur
@@ -0,0 +1,46 @@
+con stringify = fold (fn nm :: Name => fn u :: Unit => fn t :: {Type} => [nm = string] ++ t) []
+
+signature S = sig
+ con rs :: {Unit}
+end
+
+signature S' = sig
+ con rs :: {Unit}
+
+ val handler : $(stringify rs) -> page
+ val page : unit -> page
+end
+
+functor F (M : S) : S' where con rs = M.rs = struct
+ con rs = M.rs
+
+ val handler = fn x : $(stringify M.rs) => <html><body>
+ {fold [fn rs :: {Unit} => $(stringify rs) -> xml body [] []]
+ (fn nm :: Name => fn u :: Unit => fn rest :: {Unit} =>
+ fn f : $(stringify rest) -> xml body [] [] =>
+ fn x : $(stringify ([nm] ++ rest)) =>
+ <body><li> {cdata x.nm}</li> {f (x -- nm)}</body>)
+ (fn x => <body></body>)
+ [M.rs] x}
+ </body></html>
+
+ val page = fn () => <html><body>
+ <lform>
+ {fold [fn rs :: {Unit} => xml lform [] (stringify rs)]
+ (fn nm :: Name => fn u :: Unit => fn rest :: {Unit} =>
+ fn frag : xml lform [] (stringify rest) =>
+ <lform><li> <textbox{nm}/></li> {useMore frag}</lform>)
+ <lform></lform>
+ [rs]}
+
+ <submit action={handler}/>
+ </lform>
+ </body></html>
+end
+
+structure M = F(struct
+ con rs = [A, B, C]
+end)
+
+open M
+