From 65785a09a50e9877e724cb1726ab6e438c0f0d88 Mon Sep 17 00:00:00 2001 From: simonpj Date: Mon, 11 Jul 2005 10:47:21 +0000 Subject: [PATCH] [project @ 2005-07-11 10:47:20 by simonpj] Wibbles to unifyFunTy error messages --- ghc/compiler/hsSyn/HsExpr.lhs | 2 +- ghc/compiler/typecheck/TcUnify.lhs | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/hsSyn/HsExpr.lhs b/ghc/compiler/hsSyn/HsExpr.lhs index 2f4ab1b..4ae6ce4 100644 --- a/ghc/compiler/hsSyn/HsExpr.lhs +++ b/ghc/compiler/hsSyn/HsExpr.lhs @@ -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 (pprDeeper (pprGRHSs ctxt grhss))] + nest 2 (pprGRHSs ctxt grhss)] where pp_name (FunRhs fun) = ppr fun -- Not pprBndr; the AbsBinds will -- have printed the signature diff --git a/ghc/compiler/typecheck/TcUnify.lhs b/ghc/compiler/typecheck/TcUnify.lhs index 0e5052a..dd9d229 100644 --- a/ghc/compiler/typecheck/TcUnify.lhs +++ b/ghc/compiler/typecheck/TcUnify.lhs @@ -185,11 +185,11 @@ subFunTys ctxt group@(MatchGroup (match:matches) _) (Check ty) thing_inside n_pats = length (hsLMatchPats match) msg = case ctxt of FunRhs fun -> ptext SLIT("The equation(s) for") <+> quotes (ppr fun) - <+> ptext SLIT("have") <+> speakN n_pats <+> ptext SLIT("arguments") + <+> ptext SLIT("have") <+> speakNOf n_pats (ptext SLIT("argument")) LambdaExpr -> sep [ ptext SLIT("The lambda expression") <+> quotes (pprSetDepth 1 $ pprMatches ctxt group), -- The pprSetDepth makes the abstraction print briefly - ptext SLIT("has") <+> speakN n_pats <+> ptext SLIT("arguments")] + ptext SLIT("has") <+> speakNOf n_pats (ptext SLIT("arguments"))] other -> pprPanic "subFunTys" (pprMatchContext ctxt) @@ -232,7 +232,8 @@ unifyFunTys error_herald arity ty mk_msg n_actual = error_herald <> comma $$ sep [ptext SLIT("but its type") <+> quotes (pprType ty), - ptext SLIT("has only") <+> speakN n_actual] + if n_actual == 0 then ptext SLIT("has none") + else ptext SLIT("has only") <+> speakN n_actual] unify_fun_ty :: Bool -> Arity -> TcRhoType -> TcM (Bool, -- Arity satisfied? -- 1.7.10.4