X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=compiler%2Ftypes%2FTypeRep.lhs;h=1660267b4ef0937463a1e988c7eec4bab6651857;hb=0472771eb382f4707c3c793dfab76a48b4c9cbc3;hp=c1670f67bd61be348484370fcbf9ec87d2512033;hpb=388e3356f71daffa62f1d4157e1e07e4c68f218a;p=ghc-hetmet.git diff --git a/compiler/types/TypeRep.lhs b/compiler/types/TypeRep.lhs index c1670f6..1660267 100644 --- a/compiler/types/TypeRep.lhs +++ b/compiler/types/TypeRep.lhs @@ -20,7 +20,7 @@ module TypeRep ( -- Pretty-printing pprType, pprParendType, pprTypeApp, pprTyThing, pprTyThingCategory, - pprPred, pprTheta, pprForAll, pprThetaArrow, pprClassPred, + pprPred, pprEqPred, pprTheta, pprForAll, pprThetaArrow, pprClassPred, -- Kinds liftedTypeKind, unliftedTypeKind, openTypeKind, @@ -428,9 +428,12 @@ pprTypeApp tc tys = ppr_type_app TopPrec (getName tc) tys pprPred :: PredType -> SDoc pprPred (ClassP cls tys) = pprClassPred cls tys pprPred (IParam ip ty) = ppr ip <> dcolon <> pprType ty -pprPred (EqPred ty1 ty2) = sep [ ppr_type FunPrec ty1 - , nest 2 (ptext (sLit "~")) - , ppr_type FunPrec ty2] +pprPred (EqPred ty1 ty2) = pprEqPred (ty1,ty2) + +pprEqPred :: (Type,Type) -> SDoc +pprEqPred (ty1,ty2) = sep [ ppr_type FunPrec ty1 + , nest 2 (ptext (sLit "~")) + , ppr_type FunPrec ty2] -- Precedence looks like (->) so that we get -- Maybe a ~ Bool -- (a->a) ~ Bool @@ -468,7 +471,8 @@ ppr_type :: Prec -> Type -> SDoc ppr_type _ (TyVarTy tv) -- Note [Infix type variables] | isSymOcc (getOccName tv) = parens (ppr tv) | otherwise = ppr tv -ppr_type _ (PredTy pred) = ifPprDebug (ptext (sLit "")) <> (ppr pred) +ppr_type p (PredTy pred) = maybeParen p TyConPrec $ + ifPprDebug (ptext (sLit "")) <> (ppr pred) ppr_type p (TyConApp tc tys) = ppr_tc_app p tc tys ppr_type p (AppTy t1 t2) = maybeParen p TyConPrec $