summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jslib/urweb.js2
-rw-r--r--src/jscomp.sml3
-rw-r--r--tests/stypes.ur3
3 files changed, 8 insertions, 0 deletions
diff --git a/jslib/urweb.js b/jslib/urweb.js
index 904e27e8..46c24bff 100644
--- a/jslib/urweb.js
+++ b/jslib/urweb.js
@@ -42,4 +42,6 @@ function dyn(s) {
}
function ts(x) { return x.toString() }
+function bs(b) { return (b ? "True" : "False") }
+
function pf() { alert("Pattern match failure") }
diff --git a/src/jscomp.sml b/src/jscomp.sml
index ef27dba9..ac3c9792 100644
--- a/src/jscomp.sml
+++ b/src/jscomp.sml
@@ -34,6 +34,7 @@ structure E = MonoEnv
structure U = MonoUtil
val funcs = [(("Basis", "alert"), "alert"),
+ (("Basis", "htmlifyBool"), "bs"),
(("Basis", "htmlifyFloat"), "ts"),
(("Basis", "htmlifyInt"), "ts"),
(("Basis", "htmlifyString"), "escape"),
@@ -110,6 +111,8 @@ fun jsExp mode skip outer =
fun patCon pc =
case pc of
PConVar n => str (Int.toString n)
+ | PConFfi {mod = "Basis", con = "True", ...} => str "true"
+ | PConFfi {mod = "Basis", con = "False", ...} => str "false"
| PConFfi {con, ...} => str ("\"_" ^ con ^ "\"")
fun isNullable (t, _) =
diff --git a/tests/stypes.ur b/tests/stypes.ur
index 08de343f..e5006465 100644
--- a/tests/stypes.ur
+++ b/tests/stypes.ur
@@ -4,6 +4,7 @@ fun main () : transaction page =
sBoth <- source (7, 42.1);
sOpt <- source None;
+ sBool <- source True;
return <xml><body>
<dyn signal={n <- signal sInt; return <xml>{[n + 3]}</xml>}/> <a onclick={set sInt 1}>Change</a><br/>
@@ -20,4 +21,6 @@ fun main () : transaction page =
None => return <xml>None</xml>
| Some n => return <xml>{[n]}</xml>}/>
<a onclick={set sOpt (Some 7)}>Change</a><br/>
+
+ <dyn signal={b <- signal sBool; return <xml>{[b]}</xml>}/> <a onclick={set sBool False}>Change</a><br/>
</body></xml>