[project @ 2006-01-09 14:25:44 by simonmar]
[ghc-hetmet.git] / ghc / compiler / ndpFlatten / NDPCoreUtils.hs
index 1d221ba..6e6b94f 100644 (file)
@@ -51,14 +51,13 @@ module NDPCoreUtils (
 import Panic      (panic)
 import Outputable (Outputable(ppr), pprPanic)
 import BasicTypes (Boxity(..))
-import Var        (Var)
 import Type       (Type, splitTyConApp_maybe, splitFunTy)
-import TyCon      (TyCon(..), isTupleTyCon)
-import PrelNames  (parrTyConName)
+import TyCon      (isTupleTyCon)
 import TysWiredIn (parrTyCon, unitDataConId, tupleCon, intDataCon, mkPArrTy,
                   boolTy) 
-import CoreSyn    (CoreBndr, CoreExpr, CoreBind, CoreAlt, Expr(..), AltCon(..),
+import CoreSyn    (CoreExpr, CoreAlt, Expr(..), AltCon(..),
                   Bind(..), mkConApp)
+import PprCore   ( {- instances -} )
 import Var        (Id)
 import VarEnv     (IdEnv, delVarEnv, delVarEnvList, lookupVarEnv)
 
@@ -85,12 +84,12 @@ funTyArgs  = splitFunTy
 
 -- for a type of the form `[:t:]', yield `t' (EXPORTED)
 --
--- * if the type has any other form, a fatal error occurs
+--  * if the type has any other form, a fatal error occurs
 --
 parrElemTy    :: Type -> Type
 parrElemTy ty  = 
   case splitTyConApp_maybe ty of
-    Just (tyCon, [argTy]) | tyConName tyCon == parrTyConName -> argTy
+    Just (tyCon, [argTy]) | tyCon == parrTyCon -> argTy
     _                                                       -> 
       pprPanic "NDPCoreUtils.parrElemTy: wrong type: " (ppr ty)
 
@@ -101,7 +100,7 @@ parrElemTy ty  =
 -- make a tuple construction expression from a list of argument types and
 -- argument values (EXPORTED)
 --
--- * the two lists need to be of the same length
+--  * the two lists need to be of the same length
 --
 mkTuple                                  :: [Type] -> [CoreExpr] -> CoreExpr
 mkTuple []  []                            = Var unitDataConId
@@ -164,12 +163,12 @@ substIdEnv env (Let (Rec bnds) expr) =
      newExpr = substIdEnv newEnv expr 
      substBnd (b,e) = (b, substIdEnv newEnv e)      
    in Let (Rec (map substBnd bnds)) newExpr
-substIdEnv env (Case expr b alts) =
-   Case (substIdEnv newEnv expr) b (map substAlt alts)
+substIdEnv env (Case expr b ty alts) =
+   Case (substIdEnv newEnv expr) b ty (map substAlt alts)
    where
      newEnv = delVarEnv env b
      substAlt (c, bnds, expr) =
        (c, bnds, substIdEnv (delVarEnvList env bnds) expr)
 substIdEnv env (Note n expr) =
   Note n (substIdEnv env expr)
-substIdEnv env e@(Type t) = e
\ No newline at end of file
+substIdEnv env e@(Type t) = e