[project @ 2005-01-31 13:25:33 by simonpj]
[ghc-hetmet.git] / ghc / compiler / simplCore / SimplEnv.lhs
index 5f6dca2..5049a9f 100644 (file)
@@ -46,6 +46,7 @@ import IdInfo         ( IdInfo, vanillaIdInfo, occInfo, setOccInfo, specInfo, setSpecIn
                          unknownArity, workerExists
                            )
 import CoreSyn
+import Unify           ( TypeRefinement )
 import Rules           ( RuleBase )
 import CoreUtils       ( needsCaseBinding )
 import CostCentre      ( CostCentreStack, subsumedCCS )
@@ -308,22 +309,19 @@ Given an idempotent substitution, generated by the unifier, use it to
 refine the environment
 
 \begin{code}
-refineSimplEnv :: SimplEnv -> TvSubstEnv -> [OutTyVar] -> SimplEnv
+refineSimplEnv :: SimplEnv -> TypeRefinement -> SimplEnv
 -- The TvSubstEnv is the refinement, and it refines OutTyVars into OutTypes
 refineSimplEnv env@(SimplEnv { seTvSubst = tv_subst, seInScope = in_scope })
-              refine_tv_subst tvs
+              (refine_tv_subst, all_bound_here)
   = env { seTvSubst = composeTvSubst in_scope refine_tv_subst tv_subst,
          seInScope = in_scope' }
   where
     in_scope' 
-       | all bound_here (varEnvKeys refine_tv_subst) = in_scope
+       | all_bound_here = in_scope
                -- The tvs are the tyvars bound here.  If only they 
                -- are refined, there's no need to do anything 
        | otherwise = mapInScopeSet refine_id in_scope
 
-    bound_here uniq = elemVarSetByKey uniq tv_set
-    tv_set = mkVarSet tvs
-
     refine_id v        -- Only refine its type; any rules will get
                        -- refined if they are used (I hope)
        | isId v    = setIdType v (Type.substTy refine_subst (idType v))