mkFunTy, splitAppTy_maybe, splitForAllTy_maybe, coreView,
kindView, mkTyConApp, isCoercionKind, isEqPred, mkAppTys,
coreEqType, splitAppTys, isTyVarTy, splitTyConApp_maybe,
- tyVarsOfType
+ tyVarsOfType, mkTyVarTys
)
-import TyCon ( TyCon, tyConArity, mkCoercionTyCon, isNewTyCon,
- newTyConRhs, newTyConCo,
+import TyCon ( TyCon, tyConArity, mkCoercionTyCon, isClosedNewTyCon,
+ newTyConRhs, newTyConCo_maybe,
isCoercionTyCon, isCoercionTyCon_maybe )
import Var ( Var, TyVar, isTyVar, tyVarKind )
import VarSet ( elemVarSet )
where
coArity = length tvs
- rule args = (substTyWith tvs tys $ -- with sigma = [tys/tvs],
- TyConApp family instTys, -- sigma (F ts)
- TyConApp rep_tycon instTys, -- :=: R tys
- rest) -- surplus arguments
+ rule args = (substTyWith tvs tys $ -- with sigma = [tys/tvs],
+ TyConApp family instTys, -- sigma (F ts)
+ TyConApp rep_tycon tys, -- :=: R tys
+ rest) -- surplus arguments
where
tys = take coArity args
rest = drop coArity args
splitNewTypeRepCo_maybe ty
| Just ty' <- coreView ty = splitNewTypeRepCo_maybe ty'
splitNewTypeRepCo_maybe (TyConApp tc tys)
- | isNewTyCon tc
+ | isClosedNewTyCon tc
= ASSERT( tys `lengthIs` tyConArity tc ) -- splitNewTypeRepCo_maybe only be applied
-- to *types* (of kind *)
case newTyConRhs tc of
ASSERT( length tvs == length tys )
Just (substTyWith tvs tys rep_ty, mkTyConApp co_con tys)
where
- co_con = maybe (pprPanic "splitNewTypeRepCo_maybe" (ppr tc)) id (newTyConCo tc)
+ co_con = maybe (pprPanic "splitNewTypeRepCo_maybe" (ppr tc)) id (newTyConCo_maybe tc)
splitNewTypeRepCo_maybe other = Nothing
\end{code}