blob: 92866e6912a20a288a4dd572f872debca1fa284c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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>
|