From a735f6ea0ef8ec5895dfe7f895f89ee8c126de14 Mon Sep 17 00:00:00 2001 From: Adam Chlipala Date: Thu, 28 May 2009 12:07:05 -0400 Subject: Destructing local let, to the point where demo compiles --- src/explify.sml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/explify.sml') diff --git a/src/explify.sml b/src/explify.sml index d8bd6bff..3ec588fa 100644 --- a/src/explify.sml +++ b/src/explify.sml @@ -123,11 +123,14 @@ fun explifyExp (e, loc) = | 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) -- cgit v1.2.3