diff src/explify.sml @ 825:7f871c03e3a1

Destructing local let, to the point where demo compiles
author Adam Chlipala <adamc@hcoop.net>
date Thu, 28 May 2009 12:07:05 -0400
parents 0e554bfd6d6a
children b2311dfb3158
line wrap: on
line diff
--- a/src/explify.sml	Thu May 28 11:45:45 2009 -0400
+++ b/src/explify.sml	Thu May 28 12:07:05 2009 -0400
@@ -123,11 +123,14 @@
       | L.EUnif (ref (SOME e)) => explifyExp e
       | L.EUnif _ => raise Fail ("explifyExp: Undetermined EUnif at " ^ EM.spanToString loc)
 
-      | L.ELet (des, e) =>
+      | L.ELet (des, e, t) =>
         foldr (fn ((de, loc), e) =>
                   case de of
                       L.EDValRec _ => raise Fail "explifyExp: Local 'val rec' remains"
-                    | L.EDVal (x, t, e') => (L'.ELet (x, explifyCon t, explifyExp e', e), loc))
+                    | L.EDVal ((L.PVar (x, _), _), t', e') => (L'.ELet (x, explifyCon t', explifyExp e', e), loc)
+                    | L.EDVal (p, t', e') => (L'.ECase (explifyExp e',
+                                                        [(explifyPat p, e)],
+                                                        {disc = explifyCon t', result = explifyCon t}), loc))
         (explifyExp e) des
 
       | L.EKAbs (x, e) => (L'.EKAbs (x, explifyExp e), loc)