Mercurial > urweb
view tests/dynlines.ur @ 2152:2d9e40e726f2
Adjust new [assert] to work properly from top.ur
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Wed, 03 Jun 2015 09:55:37 -0400 |
parents | 38297294cf98 |
children |
line wrap: on
line source
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>