+checkTypeEquality :: Type.Type -> Type.Type -> Prelude.Bool
+-- checkTypeEquality t1 t2 = Type.coreEqType (coreViewDeep t1) (coreViewDeep t2)
+-- checkTypeEquality t1 t2 = Type.tcEqType (coreViewDeep t1) (coreViewDeep t2)
+checkTypeEquality t1 t2 = Type.tcEqType (Type.expandTypeSynonyms t1) (Type.expandTypeSynonyms t2)
+
+--showType t = outputableToString (Type.expandTypeSynonyms t)
+showType t = outputableToString (coreViewDeep t)
+
+coreViewDeep :: Type.Type -> Type.Type
+coreViewDeep t =
+ case t of
+ TypeRep.TyVarTy tv -> TypeRep.TyVarTy tv
+ TypeRep.FunTy arg res -> TypeRep.FunTy (coreViewDeep arg) (coreViewDeep res)
+ TypeRep.AppTy fun arg -> TypeRep.AppTy (coreViewDeep fun) (coreViewDeep arg)
+ TypeRep.ForAllTy fun arg -> TypeRep.ForAllTy fun (coreViewDeep arg)
+ TypeRep.TyConApp tc tys -> let t' = TypeRep.TyConApp tc (Prelude.map coreViewDeep tys)
+ in case Type.coreView t' of
+ Prelude.Nothing -> t'
+ Prelude.Just t'' -> t''
+ TypeRep.PredTy p -> case Type.coreView t of
+ Prelude.Nothing -> TypeRep.PredTy p
+ Prelude.Just t' -> t'