diff src/mono_env.sml @ 188:8e9f97508f0d

Datatype representation optimization
author Adam Chlipala <adamc@hcoop.net>
date Sun, 03 Aug 2008 19:49:21 -0400
parents c0ea24dcb86f
children 890a61991263
line wrap: on
line diff
--- a/src/mono_env.sml	Sun Aug 03 19:01:16 2008 -0400
+++ b/src/mono_env.sml	Sun Aug 03 19:49:21 2008 -0400
@@ -98,9 +98,10 @@
         DDatatype (x, n, xncs) =>
         let
             val env = pushDatatype env x n xncs
+            val dt = (TDatatype (MonoUtil.classifyDatatype xncs, n, xncs), loc)
         in
-            foldl (fn ((x', n', NONE), env) => pushENamed env x' n' (TDatatype (n, xncs), loc) NONE ""
-                    | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, (TDatatype (n, xncs), loc)), loc) NONE "")
+            foldl (fn ((x', n', NONE), env) => pushENamed env x' n' dt NONE ""
+                    | ((x', n', SOME t), env) => pushENamed env x' n' (TFun (t, dt), loc) NONE "")
             env xncs
         end
       | DVal (x, n, t, e, s) => pushENamed env x n t (SOME e) s
@@ -112,8 +113,8 @@
         PWild => env
       | PVar (x, t) => pushERel env x t NONE
       | PPrim _ => env
-      | PCon (_, NONE) => env
-      | PCon (_, SOME p) => patBinds env p
+      | PCon (_, _, NONE) => env
+      | PCon (_, _, SOME p) => patBinds env p
       | PRecord xps => foldl (fn ((_, p, _), env) => patBinds env p) env xps
 
 end