Commit b988dc39 authored by Simon Peyton Jones's avatar Simon Peyton Jones
Browse files

Suppress a misleading error message (Trac #7869)

We were saying
     The function `f' is applied to one argument,
     but its type `[a] -> b' has only one
which is obviously bogus.

This fix suppresses the explanation in cases where it may not
be the *right* explanation.
parent d3149f60
......@@ -153,12 +153,15 @@ matchExpectedFunTys herald arity orig_ty
Flexi -> defer n_req ty }
-- In all other cases we bale out into ordinary unification
go n_req ty = defer n_req ty
-- However unlike the meta-tyvar case, we are sure that the
-- number of arrows doesn't match up, so we can add a bit
-- more context to the error message (cf Trac #7869)
go n_req ty = addErrCtxtM mk_ctxt $
defer n_req ty
defer n_req fun_ty
= addErrCtxtM mk_ctxt $
do { arg_tys <- newFlexiTyVarTys n_req openTypeKind
= do { arg_tys <- newFlexiTyVarTys n_req openTypeKind
-- See Note [Foralls to left of arrow]
; res_ty <- newFlexiTyVarTy openTypeKind
; co <- unifyType fun_ty (mkFunTys arg_tys res_ty)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment