# HG changeset patch # User Adam Chlipala # Date 1230826388 18000 # Node ID 1c969230ee7fb41055dedb4ebcb15da735653353 # Parent 35471f0679800965cfcf1995d71a544e3e10aeca Reactive bool diff -r 35471f067980 -r 1c969230ee7f jslib/urweb.js --- a/jslib/urweb.js Thu Jan 01 11:04:09 2009 -0500 +++ b/jslib/urweb.js Thu Jan 01 11:13:08 2009 -0500 @@ -42,4 +42,6 @@ } function ts(x) { return x.toString() } +function bs(b) { return (b ? "True" : "False") } + function pf() { alert("Pattern match failure") } diff -r 35471f067980 -r 1c969230ee7f src/jscomp.sml --- a/src/jscomp.sml Thu Jan 01 11:04:09 2009 -0500 +++ b/src/jscomp.sml Thu Jan 01 11:13:08 2009 -0500 @@ -34,6 +34,7 @@ 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 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 -r 35471f067980 -r 1c969230ee7f tests/stypes.ur --- a/tests/stypes.ur Thu Jan 01 11:04:09 2009 -0500 +++ b/tests/stypes.ur Thu Jan 01 11:13:08 2009 -0500 @@ -4,6 +4,7 @@ sBoth <- source (7, 42.1); sOpt <- source None; + sBool <- source True; return {[n + 3]}}/> Change
@@ -20,4 +21,6 @@ None => return None | Some n => return {[n]}}/> Change
+ + {[b]}}/> Change