Fix type checker error message
authorsimonpj@microsoft.com <unknown>
Tue, 1 Feb 2011 12:29:20 +0000 (12:29 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 1 Feb 2011 12:29:20 +0000 (12:29 +0000)
See Trac #4940. We had a message
     The lambda expression `\ x -> x' has one argument one argument,
repeating the "one argument" part.  Easy fix.

compiler/typecheck/TcMatches.lhs

index 2453360..860a6db 100644 (file)
@@ -104,15 +104,15 @@ tcMatchesCase ctxt scrut_ty matches res_ty
 
 tcMatchLambda :: MatchGroup Name -> TcRhoType -> TcM (HsWrapper, MatchGroup TcId)
 tcMatchLambda match res_ty 
 
 tcMatchLambda :: MatchGroup Name -> TcRhoType -> TcM (HsWrapper, MatchGroup TcId)
 tcMatchLambda match res_ty 
-  = matchFunTys doc n_pats res_ty  $ \ pat_tys rhs_ty ->
+  = matchFunTys herald n_pats res_ty  $ \ pat_tys rhs_ty ->
     tcMatches match_ctxt pat_tys rhs_ty match
   where
     n_pats = matchGroupArity match
     tcMatches match_ctxt pat_tys rhs_ty match
   where
     n_pats = matchGroupArity match
-    doc = sep [ ptext (sLit "The lambda expression")
-                <+> quotes (pprSetDepth (PartWay 1) $ 
+    herald = sep [ ptext (sLit "The lambda expression")
+                        <+> quotes (pprSetDepth (PartWay 1) $ 
                              pprMatches (LambdaExpr :: HsMatchContext Name) match),
                        -- The pprSetDepth makes the abstraction print briefly
                              pprMatches (LambdaExpr :: HsMatchContext Name) match),
                        -- The pprSetDepth makes the abstraction print briefly
-               ptext (sLit "has") <+> speakNOf n_pats (ptext (sLit "argument"))]
+               ptext (sLit "has")]
     match_ctxt = MC { mc_what = LambdaExpr,
                      mc_body = tcBody }
 \end{code}
     match_ctxt = MC { mc_what = LambdaExpr,
                      mc_body = tcBody }
 \end{code}