summaryrefslogtreecommitdiff
path: root/tests/dynlines.ur
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adam@chlipala.net>2012-08-02 18:12:37 -0400
committerGravatar Adam Chlipala <adam@chlipala.net>2012-08-02 18:12:37 -0400
commitcdb7e3faa2ed5749eb3b11a2545cc679d054376a (patch)
tree212d4eb5fff81460457ee63a17c13dc26b79091b /tests/dynlines.ur
parent342c17de79e7624affa866ee9eab9027453ae99e (diff)
New NameJs phase, still needing some debugging
Diffstat (limited to 'tests/dynlines.ur')
-rw-r--r--tests/dynlines.ur33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/dynlines.ur b/tests/dynlines.ur
new file mode 100644
index 00000000..92866e69
--- /dev/null
+++ b/tests/dynlines.ur
@@ -0,0 +1,33 @@
+datatype lines = End | Line of source lines
+
+type t = { Head : source lines, Tail : source (source lines) }
+
+val create =
+ head <- source End;
+ tail <- source head;
+ return {Head = head, Tail = tail}
+
+fun renderL lines =
+ case lines of
+ End => <xml/>
+ | Line linesS => <xml>X<br/><dyn signal={renderS linesS}/></xml>
+
+and renderS linesS =
+ lines <- signal linesS;
+ return (renderL lines)
+
+fun render t = renderS t.Head
+
+fun write t =
+ oldTail <- get t.Tail;
+ newTail <- source End;
+ set oldTail (Line newTail);
+ set t.Tail newTail
+
+fun main () : transaction page =
+ b <- create;
+
+ return <xml><body>
+ <button onclick={fn _ => write b}/>
+ <dyn signal={render b}/>
+ </body></xml>