X-Git-Url: http://git.megacz.com/?p=ghc-hetmet.git;a=blobdiff_plain;f=compiler%2FhsSyn%2FHsExpr.lhs;h=7683faef5fa50078a0a59dd2a70ac3620afa65e1;hp=c8ce17ee95f5629d58352f905367a68ba73a954b;hb=206b4dec78250efef3cd927d64dc6cbc54a16c3d;hpb=1286da96dc65faa5992a8a34c5b3bf29dfe2be04 diff --git a/compiler/hsSyn/HsExpr.lhs b/compiler/hsSyn/HsExpr.lhs index c8ce17e..7683fae 100644 --- a/compiler/hsSyn/HsExpr.lhs +++ b/compiler/hsSyn/HsExpr.lhs @@ -370,12 +370,15 @@ ppr_expr (SectionR op expr) pp_infixly v = (sep [pprInfix v, pp_expr]) -ppr_expr (HsLam matches :: HsExpr id) - = pprMatches (LambdaExpr :: HsMatchContext id) matches +--avoid using PatternSignatures for stage1 code portability +ppr_expr exprType@(HsLam matches) + = pprMatches (LambdaExpr `asTypeOf` idType exprType) matches + where idType :: HsExpr id -> HsMatchContext id; idType = undefined -ppr_expr (HsCase expr matches :: HsExpr id) +ppr_expr exprType@(HsCase expr matches) = sep [ sep [ptext SLIT("case"), nest 4 (ppr expr), ptext SLIT("of")], - nest 2 (pprMatches (CaseAlt :: HsMatchContext id) matches) ] + nest 2 (pprMatches (CaseAlt `asTypeOf` idType exprType) matches) ] + where idType :: HsExpr id -> HsMatchContext id; idType = undefined ppr_expr (HsIf e1 e2 e3) = sep [hsep [ptext SLIT("if"), nest 2 (ppr e1), ptext SLIT("then")], @@ -699,8 +702,10 @@ pprFunBind fun inf matches = pprMatches (FunRhs fun inf) matches -- Exported to HsBinds, which can't see the defn of HsMatchContext pprPatBind :: (OutputableBndr bndr, OutputableBndr id) => LPat bndr -> GRHSs id -> SDoc -pprPatBind pat (grhss :: GRHSs id) - = sep [ppr pat, nest 4 (pprGRHSs (PatBindRhs :: HsMatchContext id) grhss)] +pprPatBind pat ty@(grhss) + = sep [ppr pat, nest 4 (pprGRHSs (PatBindRhs `asTypeOf` idType ty) grhss)] +--avoid using PatternSignatures for stage1 code portability + where idType :: GRHSs id -> HsMatchContext id; idType = undefined pprMatch :: (OutputableBndr idL, OutputableBndr idR) => HsMatchContext idL -> Match idR -> SDoc