diff src/mono_opt.sml @ 1176:51e596feec37

Tone down Reduce and compensate with a new push-lambda-inside-case rule in MonoOpt; expand more Basis synonyms in Monoize
author Adam Chlipala <adamc@hcoop.net>
date Tue, 02 Mar 2010 16:00:48 -0500
parents 217eb87dde31
children 83b1853d1e58
line wrap: on
line diff
--- a/src/mono_opt.sml	Tue Mar 02 10:33:49 2010 -0500
+++ b/src/mono_opt.sml	Tue Mar 02 16:00:48 2010 -0500
@@ -348,6 +348,22 @@
                             result = ran}), loc)
         end
 
+      | ECase (discE, pes, {disc, result = (TFun (dom, ran), loc)}) =>
+        let
+            fun doBody (p, e) =
+                let
+                    val pb = MonoEnv.patBindsN p
+                in
+                    (EApp (MonoEnv.liftExpInExp pb e, (ERel pb, loc)), loc)
+                end
+        in
+            EAbs ("x", dom, ran,
+                  (optExp (ECase (MonoEnv.liftExpInExp 0 discE,
+                                  map (fn (p, e) => (p, doBody (p, e))) pes,
+                                  {disc = disc,
+                                   result = ran}), loc), loc))
+        end
+
       | EWrite (EQuery {exps, tables, state, query,
                         initial = (EPrim (Prim.String ""), _),
                         body = (EStrcat ((EPrim (Prim.String s), _),