[project @ 2000-10-25 07:09:52 by simonpj]
[ghc-hetmet.git] / ghc / compiler / main / HscTypes.lhs
index f2e10d9..99b07b8 100644 (file)
@@ -30,6 +30,7 @@ module HscTypes (
        Deprecations(..), lookupDeprec,
 
        InstEnv, ClsInstEnv, DFunId,
+       PackageInstEnv, PackageRuleBase,
 
        GlobalRdrEnv, RdrAvailInfo,
 
@@ -51,6 +52,7 @@ import OccName                ( OccName )
 import Module          ( Module, ModuleName, ModuleEnv,
                          lookupModuleEnv, lookupModuleEnvByName
                        )
+import Rules           ( RuleBase )
 import VarSet          ( TyVarSet )
 import VarEnv          ( emptyVarEnv )
 import Id              ( Id )
@@ -148,7 +150,7 @@ data ModDetails
        -- The next three fields are created by the typechecker
         md_types    :: TypeEnv,
         md_insts    :: [DFunId],       -- Dfun-ids for the instances in this module
-        md_rules    :: RuleEnv         -- Domain may include Ids from other modules
+        md_rules    :: [(Id,CoreRule)] -- Domain may include Ids from other modules
      }
 \end{code}
 
@@ -157,7 +159,7 @@ emptyModDetails :: ModDetails
 emptyModDetails
   = ModDetails { md_types = emptyTypeEnv,
                  md_insts = [],
-                 md_rules = emptyRuleEnv
+                 md_rules = []
     }
 
 emptyModIface :: Module -> ModIface
@@ -299,12 +301,9 @@ lookupDeprec iface name
        DeprecSome env -> lookupNameEnv env name
 
 type InstEnv    = UniqFM ClsInstEnv            -- Maps Class to instances for that class
+
 type ClsInstEnv = [(TyVarSet, [Type], DFunId)] -- The instances for a particular class
 type DFunId    = Id
-
-type RuleEnv    = NameEnv [CoreRule]
-
-emptyRuleEnv    = emptyVarEnv
 \end{code}
 
 
@@ -381,14 +380,18 @@ data PersistentCompilerState
    = PCS {
         pcs_PIT :: PackageIfaceTable,  -- Domain = non-home-package modules
                                        --   the mi_decls component is empty
+
         pcs_PST :: PackageSymbolTable, -- Domain = non-home-package modules
                                        --   except that the InstEnv components is empty
-       pcs_insts :: InstEnv,           -- The total InstEnv accumulated from all
+
+       pcs_insts :: PackageInstEnv,    -- The total InstEnv accumulated from all
                                        --   the non-home-package modules
-       pcs_rules :: RuleEnv,           -- Ditto RuleEnv
+
+       pcs_rules :: PackageRuleBase,   -- Ditto RuleEnv
 
         pcs_PRS :: PersistentRenamerState
      }
+
 \end{code}
 
 The @PersistentRenamerState@ persists across successive calls to the
@@ -411,6 +414,9 @@ It contains:
     interface files but not yet sucked in, renamed, and typechecked
 
 \begin{code}
+type PackageRuleBase = RuleBase
+type PackageInstEnv  = InstEnv
+
 data PersistentRenamerState
   = PRS { prsOrig  :: OrigNameEnv,
          prsDecls :: DeclsMap,