From e5cc0e3da51641157cbec8989ccc709f989b730c Mon Sep 17 00:00:00 2001 From: David Waern Date: Fri, 9 Jan 2009 19:17:13 +0000 Subject: [PATCH] Fix Trac #2584: Pretty printing of types with HsDocTy The pretty printing clause for HsDocTy was wrong, causing brackets to be left out. We now print Haddock comments on types as if they were postfix type operators. --- compiler/hsSyn/HsTypes.lhs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compiler/hsSyn/HsTypes.lhs b/compiler/hsSyn/HsTypes.lhs index 04609c6..7d91a42 100644 --- a/compiler/hsSyn/HsTypes.lhs +++ b/compiler/hsSyn/HsTypes.lhs @@ -376,8 +376,11 @@ ppr_mono_ty _ (HsParTy ty) -- But we still use the precedence stuff to add parens because -- toHsType doesn't put in any HsParTys, so we may still need them -ppr_mono_ty _ (HsDocTy ty doc) - = ppr ty <+> ppr (unLoc doc) +ppr_mono_ty ctxt_prec (HsDocTy ty doc) + = maybeParen ctxt_prec pREC_OP $ + ppr_mono_lty pREC_OP ty <+> ppr (unLoc doc) + -- we pretty print Haddock comments on types as if they were + -- postfix operators -------------------------- ppr_fun_ty :: (OutputableBndr name) => Int -> LHsType name -> LHsType name -> SDoc -- 1.7.10.4