diff tests/nextid.ur @ 1556:e1f5d9c4cc20

An abstract type of IDs
author Adam Chlipala <adam@chlipala.net>
date Sat, 03 Sep 2011 12:51:05 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nextid.ur	Sat Sep 03 12:51:05 2011 -0400
@@ -0,0 +1,11 @@
+fun main () : transaction page =
+    id1 <- fresh;
+    id2 <- fresh;
+    id3 <- fresh;
+    idS <- source id3;
+    return <xml><body>
+      <span id={id1}>Hi</span> <span id={id2}>there!</span><br/><br/>
+      <dyn signal={idS <- signal idS; return <xml><span id={idS}>Whoa-hoa!</span></xml>}/>
+      <button onclick={id <- fresh; set idS id}/>
+      Source: <dyn signal={idS <- signal idS; return (txt (<xml><span id={idS}>Whoa-hoa!</span></xml> : xbody))}/>
+    </body></xml>