diff src/cjr_env.sml @ 809:81fce435e255

Mutual datatypes through Cjrize
author Adam Chlipala <adamc@hcoop.net>
date Sat, 16 May 2009 16:02:17 -0400
parents 8688e01ae469
children b2311dfb3158
line wrap: on
line diff
--- a/src/cjr_env.sml	Sat May 16 15:55:15 2009 -0400
+++ b/src/cjr_env.sml	Sat May 16 16:02:17 2009 -0400
@@ -137,15 +137,16 @@
 
 fun declBinds env (d, loc) =
     case d of
-        DDatatype (_, x, n, xncs) =>
-        let
-            val env = pushDatatype env x n xncs
-            val dt = (TDatatype (classifyDatatype xncs, n, ref xncs), loc)
-        in
-            foldl (fn ((x', n', NONE), env) => pushENamed env x' n' dt
-                    | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, dt), loc))
-            env xncs
-        end
+        DDatatype dts =>
+        foldl (fn ((_, x, n, xncs), env) =>
+                  let
+                      val env = pushDatatype env x n xncs
+                      val dt = (TDatatype (classifyDatatype xncs, n, ref xncs), loc)
+                  in
+                      foldl (fn ((x', n', NONE), env) => pushENamed env x' n' dt
+                              | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, dt), loc))
+                            env xncs
+                  end) env dts
       | DDatatypeForward (_, x, n) => pushDatatype env x n []
       | DStruct (n, xts) => pushStruct env n xts
       | DVal (x, n, t, _) => pushENamed env x n t