predTypeRep, mkPredTy, mkPredTys,
-- Newtypes
- splitRecNewType_maybe,
+ splitRecNewType_maybe, newTyConInstRhs,
-- Lifting and boxity
isUnLiftedType, isUnboxedTupleType, isAlgType, isPrimitiveType,
splitNewTyConApp_maybe (FunTy arg res) = Just (funTyCon, [arg,res])
splitNewTyConApp_maybe other = Nothing
+-- get instantiated newtype rhs, the arguments had better saturate
+-- the constructor
+newTyConInstRhs :: TyCon -> [Type] -> Type
+newTyConInstRhs tycon tys =
+ let (tvs, ty) = newTyConRhs tycon in substTyWith tvs tys ty
+
\end{code}