From 9fe510d19e48f1cefdf3591c8669cd74a63867b7 Mon Sep 17 00:00:00 2001 From: simonpj Date: Mon, 11 Jul 2005 09:54:44 +0000 Subject: [project @ 2005-07-11 09:54:43 by simonpj] Improve the error message from unifyFunTys. Previously we got a really horrible message from this: t = ((\Just x -> x) :: Maybe a -> a) (Just 1) Try.hs:1:6: Couldn't match the rigid variable `a' against `t -> t1' Expected type: a Inferred type: t -> t1 Now it's much better: Try.hs:14:6: The lambda expression `\ Just x -> ...' has two arguments, but its type `Maybe a -> a' has only one In the expression: (\ Just x -> x) :: Maybe a -> a tcfail140 tests some cases --- ghc/compiler/hsSyn/HsExpr.lhs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'ghc/compiler/hsSyn/HsExpr.lhs') diff --git a/ghc/compiler/hsSyn/HsExpr.lhs b/ghc/compiler/hsSyn/HsExpr.lhs index 3f061964e6..2f4ab1b9b6 100644 --- a/ghc/compiler/hsSyn/HsExpr.lhs +++ b/ghc/compiler/hsSyn/HsExpr.lhs @@ -319,7 +319,7 @@ ppr_expr (SectionL expr op) pp_prefixly = hang (hsep [text " \\ x_ ->", ppr op]) 4 (hsep [pp_expr, ptext SLIT("x_ )")]) - pp_infixly v = parens (sep [pp_expr, ppr v]) + pp_infixly v = parens (sep [pp_expr, pprInfix v]) ppr_expr (SectionR op expr) = case unLoc op of @@ -331,7 +331,7 @@ ppr_expr (SectionR op expr) pp_prefixly = hang (hsep [text "( \\ x_ ->", ppr op, ptext SLIT("x_")]) 4 ((<>) pp_expr rparen) pp_infixly v - = parens (sep [ppr v, pp_expr]) + = parens (sep [pprInfix v, pp_expr]) ppr_expr (HsLam matches) = pprMatches LambdaExpr matches @@ -647,7 +647,7 @@ pprMatch :: OutputableBndr id => HsMatchContext id -> Match id -> SDoc pprMatch ctxt (Match pats maybe_ty grhss) = pp_name ctxt <+> sep [sep (map ppr pats), ppr_maybe_ty, - nest 2 (pprGRHSs ctxt grhss)] + nest 2 (pprDeeper (pprGRHSs ctxt grhss))] where pp_name (FunRhs fun) = ppr fun -- Not pprBndr; the AbsBinds will -- have printed the signature -- cgit v1.2.1