[project @ 2005-02-25 12:50:48 by simonpj]
[ghc-hetmet.git] / ghc / compiler / simplCore / SimplEnv.lhs
index 8a3841f..5049a9f 100644 (file)
@@ -46,9 +46,9 @@ import IdInfo         ( IdInfo, vanillaIdInfo, occInfo, setOccInfo, specInfo, setSpecIn
                          unknownArity, workerExists
                            )
 import CoreSyn
+import Unify           ( TypeRefinement )
 import Rules           ( RuleBase )
 import CoreUtils       ( needsCaseBinding )
-import PprCore         ()      -- Instances
 import CostCentre      ( CostCentreStack, subsumedCCS )
 import Var     
 import VarEnv
@@ -62,7 +62,6 @@ import Type             ( Type, TvSubst(..), TvSubstEnv, composeTvSubst,
                          isUnLiftedType, seqType, tyVarsOfType )
 import BasicTypes      ( OccInfo(..), isFragileOcc )
 import CmdLineOpts     ( SimplifierMode(..) )
-import Util            ( mapAccumL )
 import Outputable
 \end{code}
 
@@ -310,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))