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)
-- 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)
-- 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
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