changeset 587:4c899701bd28

Reactive if
author Adam Chlipala <adamc@hcoop.net>
date Thu, 01 Jan 2009 11:16:57 -0500
parents 1c969230ee7f
children 5803b4f041cb
files src/jscomp.sml tests/stypes.ur
diffstat 2 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/jscomp.sml	Thu Jan 01 11:13:08 2009 -0500
+++ b/src/jscomp.sml	Thu Jan 01 11:16:57 2009 -0500
@@ -170,7 +170,19 @@
                                            str ":",
                                            fail,
                                            str ")"]
-                      | PCon _ => raise Fail "jsPat: PCon"
+                      | PCon (_, PConFfi {mod = "Basis", con = "True", ...}, NONE) =>
+                        strcat [str ("(d" ^ Int.toString depth ^ "?"),
+                                succ,
+                                str ":",
+                                fail,
+                                str ")"]
+                      | PCon (_, PConFfi {mod = "Basis", con = "False", ...}, NONE) =>
+                        strcat [str ("(d" ^ Int.toString depth ^ "?"),
+                                fail,
+                                str ":",
+                                succ,
+                                str ")"]
+                      | PCon _ => raise Fail "PCon"
                       | PRecord xps =>
                         let
                             val (_, succ) = foldl
--- a/tests/stypes.ur	Thu Jan 01 11:13:08 2009 -0500
+++ b/tests/stypes.ur	Thu Jan 01 11:16:57 2009 -0500
@@ -22,5 +22,7 @@
                                        | 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/>
+      <dyn signal={b <- signal sBool; return <xml>{[b]}</xml>}/>
+      <dyn signal={b <- signal sBool; if b then return <xml>Yes</xml> else return <xml>No</xml>}/>
+      <a onclick={set sBool False}>Change</a><br/>
     </body></xml>