diff options
author | Adam Chlipala <adamc@hcoop.net> | 2009-01-13 15:17:11 -0500 |
---|---|---|
committer | Adam Chlipala <adamc@hcoop.net> | 2009-01-13 15:17:11 -0500 |
commit | 3b43441c77feb57720e3adf0d8337fd60af9364e (patch) | |
tree | a43e5082a4a3349616ad6b68329b7e363e1e7926 /tests/dlist.ur | |
parent | d71a90ca23170fd7fef9ad0f9ccf6afc01d3f372 (diff) |
Initial experiments with nested <dyn>
Diffstat (limited to 'tests/dlist.ur')
-rw-r--r-- | tests/dlist.ur | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/dlist.ur b/tests/dlist.ur new file mode 100644 index 00000000..211291bc --- /dev/null +++ b/tests/dlist.ur @@ -0,0 +1,22 @@ +datatype dlist = Nil | Cons of string * source dlist + +fun delist dl = + case dl of + Nil => <xml>[]</xml> + | Cons (x, s) => <xml>{[x]} :: {delistSource s}</xml> + +and delistSource s = <xml><dyn signal={dl <- signal s; return (delist dl)}/></xml> + +fun main () : transaction page = + ns <- source Nil; + s <- source ns; + tb <- source ""; + return <xml><body> + <dyn signal={s <- signal s; return (delistSource s)}/><br/> + <br/> + <ctextbox source={tb}/> + <button value="Add" onclick={hd <- get tb; + tl <- get s; + s' <- source (Cons (hd, tl)); + set s s'}/> + </body></xml> |