[project @ 2001-03-23 10:47:21 by simonpj]
[ghc-hetmet.git] / ghc / compiler / coreSyn / Subst.lhs
index 5471a23..90a3ead 100644 (file)
@@ -28,7 +28,7 @@ module Subst (
 
        -- Type stuff
        mkTyVarSubst, mkTopTyVarSubst, 
-       substTy, substClasses, substTheta,
+       substTy, substTheta,
 
        -- Expression stuff
        substExpr, substIdInfo
@@ -41,20 +41,20 @@ import CoreSyn              ( Expr(..), Bind(..), Note(..), CoreExpr,
                          CoreRules(..), CoreRule(..), 
                          isEmptyCoreRules, seqRules, hasUnfolding, noUnfolding
                        )
-import CoreFVs         ( exprFreeVars, mustHaveLocalBinding )
+import CoreFVs         ( exprFreeVars )
 import TypeRep         ( Type(..), TyNote(..) )  -- friend
-import Type            ( ThetaType, PredType(..), ClassContext,
+import Type            ( ThetaType, PredType(..), 
                          tyVarsOfType, tyVarsOfTypes, mkAppTy, mkUTy, isUTy
                        )
 import VarSet
 import VarEnv
-import Var             ( setVarUnique, isId )
-import Id              ( idType, idInfo, setIdInfo, setIdType, idOccInfo, maybeModifyIdInfo )
-import IdInfo          ( IdInfo, mkIdInfo,
+import Var             ( setVarUnique, isId, mustHaveLocalBinding )
+import Id              ( idType, idInfo, setIdInfo, setIdType, 
+                         idOccInfo, maybeModifyIdInfo )
+import IdInfo          ( IdInfo, vanillaIdInfo,
                          occInfo, isFragileOcc, setOccInfo, 
-                         specInfo, setSpecInfo, flavourInfo,
+                         specInfo, setSpecInfo, 
                          unfoldingInfo, setUnfoldingInfo,
-                         CafInfo(NoCafRefs),
                          WorkerInfo(..), workerExists, workerInfo, setWorkerInfo, WorkerInfo,
                           lbvarInfo, LBVarInfo(..), setLBVarInfo, hasNoLBVarInfo
                        )
@@ -392,19 +392,14 @@ substTy :: Subst -> Type  -> Type
 substTy subst ty | isEmptySubst subst = ty
                 | otherwise          = subst_ty subst ty
 
-substClasses :: TyVarSubst -> ClassContext -> ClassContext
-substClasses subst theta
-  | isEmptySubst subst = theta
-  | otherwise         = [(clas, map (subst_ty subst) tys) | (clas, tys) <- theta]
-
 substTheta :: TyVarSubst -> ThetaType -> ThetaType
 substTheta subst theta
   | isEmptySubst subst = theta
   | otherwise         = map (substPred subst) theta
 
 substPred :: TyVarSubst -> PredType -> PredType
-substPred subst (Class clas tys) = Class clas (map (subst_ty subst) tys)
-substPred subst (IParam n ty)    = IParam n (subst_ty subst ty)
+substPred subst (ClassP clas tys) = ClassP clas (map (subst_ty subst) tys)
+substPred subst (IParam n ty)     = IParam n (subst_ty subst ty)
 
 subst_ty subst ty
    = go ty
@@ -566,8 +561,7 @@ simplLetId subst@(Subst in_scope env) old_id
     old_info = idInfo old_id
     id1            = uniqAway in_scope old_id
     id2     = substIdType subst id1
-    new_id  = id2 `setIdInfo` mkIdInfo (flavourInfo old_info) NoCafRefs
-               -- Zap the IdIno altogether, but preserve the flavour
+    new_id  = setIdInfo id2 vanillaIdInfo
 
        -- Extend the substitution if the unique has changed,
        -- or there's some useful occurrence information