diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-11-01 14:26:20 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-11-01 14:26:20 -0500 |
commit | 70da89d392d5c9649157e53944db9a49d2149da3 (patch) | |
tree | 554465c7355d6fe0d310a16f4a7fa5a4e0675870 /demo/more/expandable.ur | |
parent | 7aaaa9a22a7eede386cda3cfbb3fc906619415d9 (diff) |
Initial form for paper assignment
Diffstat (limited to 'demo/more/expandable.ur')
-rw-r--r-- | demo/more/expandable.ur | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/demo/more/expandable.ur b/demo/more/expandable.ur new file mode 100644 index 00000000..92d8743c --- /dev/null +++ b/demo/more/expandable.ur @@ -0,0 +1,23 @@ +con t ctx = source bool * xml ctx [] [] + +fun create [ctx] (x : xml ctx [] []) = + s <- source False; + return (s, x) + +fun expand [ctx] (t : t ctx) = + set t.1 True + +fun collapse [ctx] (t : t ctx) = + set t.1 False + +fun render [ctx] [[Body] ~ ctx] (t : t ([Body] ++ ctx)) = + <xml><dyn signal={b <- signal t.1; + return (if b then + <xml> + <button value="-" onclick={collapse t}/><br/> + {t.2} + </xml> + else + <xml> + <button value="+" onclick={expand t}/><br/> + </xml>)}/></xml> |