X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FhsSyn%2FHsTypes.lhs;fp=compiler%2FhsSyn%2FHsTypes.lhs;h=806faf29dc0e9ffdc986fa6d9d74c20ad160c84d;hp=cb06a7f548d7e243585998156f349ce142c6d4f2;hb=fc7a2876f23510ab795ab2098bbac278d29d6356;hpb=b562edc69ed995644f195943d780b2e650021318 diff --git a/compiler/hsSyn/HsTypes.lhs b/compiler/hsSyn/HsTypes.lhs index cb06a7f..806faf2 100644 --- a/compiler/hsSyn/HsTypes.lhs +++ b/compiler/hsSyn/HsTypes.lhs @@ -353,8 +353,16 @@ pprHsForAll exp tvs cxt forall_part = ptext (sLit "forall") <+> interppSP tvs <> dot pprHsContext :: (OutputableBndr name) => HsContext name -> SDoc -pprHsContext [] = empty -pprHsContext cxt = ppr_hs_context cxt <+> ptext (sLit "=>") +pprHsContext [] = empty +pprHsContext [L _ pred] + | noParenHsPred pred = ppr pred <+> ptext (sLit "=>") +pprHsContext cxt = ppr_hs_context cxt <+> ptext (sLit "=>") + +noParenHsPred :: HsPred name -> Bool +-- c.f. TypeRep.noParenPred +noParenHsPred (HsClassP {}) = True +noParenHsPred (HsEqualP {}) = True +noParenHsPred (HsIParam {}) = False ppr_hs_context :: (OutputableBndr name) => HsContext name -> SDoc ppr_hs_context [] = empty