diff tests/jsinj.ur @ 590:57f476c934da

Injecting an int
author Adam Chlipala <adamc@hcoop.net>
date Thu, 01 Jan 2009 15:11:17 -0500
parents
children 8f8771f32909
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/jsinj.ur	Thu Jan 01 15:11:17 2009 -0500
@@ -0,0 +1,14 @@
+cookie int : int
+
+fun getOpt (t ::: Type) (o : option t) (v : t) : t =
+    case o of
+        None => v
+      | Some x => x
+
+fun main () : transaction page =
+    n <- getCookie int;
+    sn <- source (getOpt n 7);
+    return <xml><body>
+      <dyn signal={n <- signal sn; return <xml>{[n]}</xml>}/>
+      <a onclick={set sn 6}>CHANGE</a>
+    </body></xml>