changeset 691:cc58941da3e2

Checking spans in dyns
author Adam Chlipala <adamc@hcoop.net>
date Sat, 04 Apr 2009 11:46:24 -0400
parents 01b6f2ee2ef0
children 09df0c85f306
files lib/js/urweb.js lib/ur/basis.urs src/jscomp.sml tests/dynSpan.ur tests/dynSpan.urp
diffstat 5 files changed, 21 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lib/js/urweb.js	Thu Apr 02 15:12:06 2009 -0400
+++ b/lib/js/urweb.js	Sat Apr 04 11:46:24 2009 -0400
@@ -154,6 +154,10 @@
     throw "Can't parse float: " + s;
 }
 
+function cat(s1, s2) {
+  return s1 + s2;
+}
+
 function whine(msg) {
   alert(msg);
   throw msg;
--- a/lib/ur/basis.urs	Thu Apr 02 15:12:06 2009 -0400
+++ b/lib/ur/basis.urs	Sat Apr 04 11:46:24 2009 -0400
@@ -375,8 +375,8 @@
 con tabl = [Body, Table]
 con tr = [Body, Tr]
 
-val dyn : ctx ::: {Unit} -> use ::: {Type} -> bind ::: {Type} -> unit
-          -> tag [Signal = signal (xml ctx use bind)] ctx [] use bind
+val dyn : use ::: {Type} -> bind ::: {Type} -> unit
+          -> tag [Signal = signal (xml body use bind)] body [] use bind
 
 val head : unit -> tag [] html head [] []
 val title : unit -> tag [] head [] [] []
@@ -393,6 +393,8 @@
 
 val br : bodyTagStandalone []
 
+val span : bodyTag []
+
 val p : bodyTag []
 val b : bodyTag []
 val i : bodyTag []
--- a/src/jscomp.sml	Thu Apr 02 15:12:06 2009 -0400
+++ b/src/jscomp.sml	Sat Apr 04 11:46:24 2009 -0400
@@ -49,7 +49,8 @@
              (("Basis", "urlifyInt"), "ts"),
              (("Basis", "urlifyFloat"), "ts"),
              (("Basis", "urlifyString"), "uf"),
-             (("Basis", "recv"), "rv")]
+             (("Basis", "recv"), "rv"),
+             (("Basis", "strcat"), "cat")]
 
 structure FM = BinaryMapFn(struct
                            type ord_key = string * string
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/dynSpan.ur	Sat Apr 04 11:46:24 2009 -0400
@@ -0,0 +1,8 @@
+val x = 1
+
+fun main () : transaction page =
+    s <- source "!";
+    return <xml><body>
+      <dyn signal={x <- signal s; return <xml><span>{[x]}</span></xml>}/>
+      <button onclick={x <- get s; set s (x ^ "!")}/>
+    </body></xml>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/dynSpan.urp	Sat Apr 04 11:46:24 2009 -0400
@@ -0,0 +1,3 @@
+debug
+
+dynSpan