From: lewie Date: Wed, 28 Jun 2000 21:54:06 +0000 (+0000) Subject: [project @ 2000-06-28 21:54:06 by lewie] X-Git-Tag: Approximately_9120_patches~4120 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=ea05704115ffb3ed246f6c9ff1cce9c063a9e368;p=ghc-hetmet.git [project @ 2000-06-28 21:54:06 by lewie] Make it so that implicit params uniformly print with the `?' at the front of the name. Simon's last big commit re-arranged how interface files were written, and implicit params were suddenly being written without the `?'. This fixes both that bug, and Simon's concern that there were too many different pretty printing functions for implicit params ;-) --- diff --git a/ghc/compiler/hsSyn/HsTypes.lhs b/ghc/compiler/hsSyn/HsTypes.lhs index f4146a4..62255d7 100644 --- a/ghc/compiler/hsSyn/HsTypes.lhs +++ b/ghc/compiler/hsSyn/HsTypes.lhs @@ -156,7 +156,7 @@ instance (Outputable name) => Outputable (HsTyVarBndr name) where instance Outputable name => Outputable (HsPred name) where ppr (HsPClass clas tys) = ppr clas <+> hsep (map pprParendHsType tys) - ppr (HsPIParam n ty) = hsep [{- char '?' <> -} ppr n, text "::", ppr ty] + ppr (HsPIParam n ty) = hsep [char '?' <> ppr n, text "::", ppr ty] pprHsTyVarBndr :: Outputable name => name -> Kind -> SDoc pprHsTyVarBndr name kind | kind == boxedTypeKind = ppr name diff --git a/ghc/compiler/types/PprType.lhs b/ghc/compiler/types/PprType.lhs index 45717e6..9374223 100644 --- a/ghc/compiler/types/PprType.lhs +++ b/ghc/compiler/types/PprType.lhs @@ -69,7 +69,8 @@ pprParendKind = pprParendType pprPred :: PredType -> SDoc pprPred (Class clas tys) = pprConstraint clas tys -pprPred (IParam n ty) = hsep [ppr n, ptext SLIT("::"), ppr ty] +pprPred (IParam n ty) = hsep [ptext SLIT("?") <> ppr n, + ptext SLIT("::"), ppr ty] pprConstraint :: Class -> [Type] -> SDoc pprConstraint clas tys = ppr clas <+> hsep (map pprParendType tys) @@ -177,12 +178,9 @@ ppr_ty env ctxt_prec ty@(ForAllTy _ _) pp_tyvars = hsep (map (pBndr env LambdaBind) tyvars) ppr_theta [] = empty - ppr_theta theta = parens (hsep (punctuate comma (map ppr_pred theta))) + ppr_theta theta = parens (hsep (punctuate comma (map (ppr_pred env) theta))) <+> ptext SLIT("=>") - ppr_pred (Class clas tys) = ppr clas <+> hsep (map (ppr_ty env tYCON_PREC) tys) - ppr_pred (IParam n ty) = hsep [{- char '?' <> -} ppr n, text "::", - ppr_ty env tYCON_PREC ty] ppr_ty env ctxt_prec (FunTy ty1 ty2) = maybeParen ctxt_prec fUN_PREC (sep (ppr_ty env fUN_PREC ty1 : pp_rest ty2))