changeset 184:98c29e3986d3

Push write inside case
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 16:53:13 -0400
parents c0ea24dcb86f
children 19ee24bffbc0
files src/mono_opt.sml src/mono_reduce.sml
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/mono_opt.sml	Sun Aug 03 13:30:27 2008 -0400
+++ b/src/mono_opt.sml	Sun Aug 03 16:53:13 2008 -0400
@@ -185,6 +185,13 @@
       | EWrite (EFfiApp ("Basis", "urlifyString", [e]), _) =>
         EFfiApp ("Basis", "urlifyString_w", [e])
 
+
+      | EWrite (ECase (discE, pes, {disc, ...}), loc) =>
+        optExp (ECase (discE,
+                       map (fn (p, e) => (p, (EWrite e, loc))) pes,
+                       {disc = disc,
+                        result = (TRecord [], loc)}), loc)
+
       | _ => e
 
 and optExp e = #1 (U.Exp.map {typ = typ, exp = exp} e)
--- a/src/mono_reduce.sml	Sun Aug 03 13:30:27 2008 -0400
+++ b/src/mono_reduce.sml	Sun Aug 03 16:53:13 2008 -0400
@@ -123,7 +123,7 @@
       | EApp ((EAbs (_, _, _, e1), loc), e2) =>
         #1 (reduceExp env (subExpInExp (0, e2) e1))
 
-      | ECase (disc, pes, t) =>
+      | ECase (disc, pes, _) =>
         (case ListUtil.search (fn (p, body) =>
                                   case match (env, p, disc) of
                                       NONE => NONE