summaryrefslogtreecommitdiff
path: root/demo/more/checkGroup.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-11-01 14:26:20 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-11-01 14:26:20 -0500
commit70da89d392d5c9649157e53944db9a49d2149da3 (patch)
tree554465c7355d6fe0d310a16f4a7fa5a4e0675870 /demo/more/checkGroup.ur
parent7aaaa9a22a7eede386cda3cfbb3fc906619415d9 (diff)
Initial form for paper assignment
Diffstat (limited to 'demo/more/checkGroup.ur')
-rw-r--r--demo/more/checkGroup.ur15
1 files changed, 15 insertions, 0 deletions
diff --git a/demo/more/checkGroup.ur b/demo/more/checkGroup.ur
new file mode 100644
index 00000000..ab1cc781
--- /dev/null
+++ b/demo/more/checkGroup.ur
@@ -0,0 +1,15 @@
+con t ctx data = list (data * xml ctx [] [] * source bool)
+
+fun create [ctx] [data] (items : list (data * xml ctx [] [] * bool)) =
+ List.mapM (fn (d, x, b) => s <- source b; return (d, x, s)) items
+
+fun render [ctx] [data] [[Body] ~ ctx] (t : t ([Body] ++ ctx) data) =
+ List.mapX (fn (_, x, s) => <xml><ccheckbox source={s}/> {x}<br/></xml>) t
+
+fun selected [ctx] [data] (t : t ctx data) =
+ List.foldlM (fn (d, _, s) ls =>
+ s <- signal s;
+ return (if s then
+ d :: ls
+ else
+ ls)) [] t