diff src/monoize.sml @ 128:b04f7422c832

Monoizing (non-mutual) 'val rec'
author Adam Chlipala <adamc@hcoop.net>
date Thu, 17 Jul 2008 10:48:25 -0400
parents fd98dd10dce7
children b1cfe49ce692
line wrap: on
line diff
--- a/src/monoize.sml	Thu Jul 17 10:43:16 2008 -0400
+++ b/src/monoize.sml	Thu Jul 17 10:48:25 2008 -0400
@@ -248,7 +248,13 @@
             L.DCon _ => NONE
           | L.DVal (x, n, t, e, s) => SOME (Env.pushENamed env x n t (SOME e) s,
                                             (L'.DVal (x, n, monoType env t, monoExp env e, s), loc))
-          | L.DValRec _ => raise Fail "Monoize DValRec"
+          | L.DValRec vis =>
+            let
+                val env = foldl (fn ((x, n, t, e, s), env) => Env.pushENamed env x n t NONE s) env vis
+            in
+                SOME (env,
+                      (L'.DValRec (map (fn (x, n, t, e, s) => (x, n, monoType env t, monoExp env e, s)) vis), loc))
+            end
           | L.DExport n =>
             let
                 val (_, t, _, s) = Env.lookupENamed env n