comparison tests/dynlines.ur @ 1800:38297294cf98

New NameJs phase, still needing some debugging
author Adam Chlipala <adam@chlipala.net>
date Thu, 02 Aug 2012 18:12:37 -0400
parents
children
comparison
equal deleted inserted replaced
1799:3d922a28370b 1800:38297294cf98
1 datatype lines = End | Line of source lines
2
3 type t = { Head : source lines, Tail : source (source lines) }
4
5 val create =
6 head <- source End;
7 tail <- source head;
8 return {Head = head, Tail = tail}
9
10 fun renderL lines =
11 case lines of
12 End => <xml/>
13 | Line linesS => <xml>X<br/><dyn signal={renderS linesS}/></xml>
14
15 and renderS linesS =
16 lines <- signal linesS;
17 return (renderL lines)
18
19 fun render t = renderS t.Head
20
21 fun write t =
22 oldTail <- get t.Tail;
23 newTail <- source End;
24 set oldTail (Line newTail);
25 set t.Tail newTail
26
27 fun main () : transaction page =
28 b <- create;
29
30 return <xml><body>
31 <button onclick={fn _ => write b}/>
32 <dyn signal={render b}/>
33 </body></xml>