-predTyUnique :: PredType -> Unique
-predTyUnique (IParam n _) = getUnique n
-predTyUnique (ClassP clas tys) = getUnique clas
-
-predRepTy :: PredType -> Type
--- Convert a predicate to its "representation type";
--- the type of evidence for that predicate, which is actually passed at runtime
-predRepTy (ClassP clas tys) = TyConApp (classTyCon clas) tys
-predRepTy (IParam n ty) = ty
-
-isPredTy :: Type -> Bool
-isPredTy (NoteTy _ ty) = isPredTy ty
-isPredTy (PredTy _) = True
-isPredTy (UsageTy _ ty)= isPredTy ty
-isPredTy _ = False
-
-isDictTy :: Type -> Bool
-isDictTy (NoteTy _ ty) = isDictTy ty
-isDictTy (PredTy (ClassP _ _)) = True
-isDictTy (UsageTy _ ty) = isDictTy ty
-isDictTy other = False
-
-splitPredTy_maybe :: Type -> Maybe PredType
-splitPredTy_maybe (NoteTy _ ty) = splitPredTy_maybe ty
-splitPredTy_maybe (PredTy p) = Just p
-splitPredTy_maybe (UsageTy _ ty)= splitPredTy_maybe ty
-splitPredTy_maybe other = Nothing
-
-splitDictTy :: Type -> (Class, [Type])
-splitDictTy (NoteTy _ ty) = splitDictTy ty
-splitDictTy (PredTy (ClassP clas tys)) = (clas, tys)
-
-splitDictTy_maybe :: Type -> Maybe (Class, [Type])
-splitDictTy_maybe (NoteTy _ ty) = splitDictTy_maybe ty
-splitDictTy_maybe (PredTy (ClassP clas tys)) = Just (clas, tys)
-splitDictTy_maybe other = Nothing
-
-splitDFunTy :: Type -> ([TyVar], [PredType], Class, [Type])
--- Split the type of a dictionary function
-splitDFunTy ty
- = case splitSigmaTy ty of { (tvs, theta, tau) ->
- case splitDictTy tau of { (clas, tys) ->
- (tvs, theta, clas, tys) }}
-
-namesOfDFunHead :: Type -> NameSet
--- Find the free type constructors and classes
--- of the head of the dfun instance type
--- The 'dfun_head_type' is because of
--- instance Foo a => Baz T where ...
--- The decl is an orphan if Baz and T are both not locally defined,
--- even if Foo *is* locally defined
-namesOfDFunHead dfun_ty = case splitSigmaTy dfun_ty of
- (tvs,_,head_ty) -> delListFromNameSet (namesOfType head_ty)
- (map getName tvs)
-
-mkPredName :: Unique -> SrcLoc -> PredType -> Name
-mkPredName uniq loc (ClassP cls tys) = mkLocalName uniq (mkDictOcc (getOccName cls)) loc
-mkPredName uniq loc (IParam name ty) = name
+predTypeRep :: PredType -> Type
+-- Convert a PredType to its "representation type";
+-- the post-type-checking type used by all the Core passes of GHC.
+-- Unwraps only the outermost level; for example, the result might
+-- be a NewTcApp; c.f. newTypeRep
+predTypeRep (IParam _ ty) = ty
+predTypeRep (ClassP clas tys) = mkTyConApp (classTyCon clas) tys
+ -- Result might be a NewTcApp, but the consumer will
+ -- look through that too if necessary