[Haskell-cafe] Re: Error message reform (was: Strange type error
with associated type synonyms)
max.rabkin at gmail.com
Wed May 27 18:14:19 EDT 2009
On Thu, May 28, 2009 at 12:03 AM, Jeff Wheeler <jeff at nokrev.com> wrote:
> I absolutely agree about expected/inferred. I always forget which is
> which, because I can figure both could apply to each.
That's actually true for me too. When you say it like that, I remember
times when I've had the same confusion.
> Better language may be much more helpful, although I'm not sure what may
> be easier to interpret.
I think one big improvement (demonstrated in Bulat's proposal) is to
put the two types near where those types come from. GHC gives you the
two types, and then the context in which they arose. Hugs gives the
context and then two types, but doesn't say which type is which.
So we say: you have here `True', it is a `Bool'. But the first
argument of `f' should be an `Int'.
Thus it's clearly indicated where the two types came from.
My preference is still to include the words "expected" and "inferred"
which indicate (to me) that *either* could be wrong. And they don't
seem to me to be compiler writers' jargon. They're both ordinary (if
not everyday) English words. But definitely we should use language
which more clearly indicates which is which.
I'll pay more attention to error messages in the future.
GHC devs: would patches for error message language be considered?
More information about the Haskell-Cafe