On Thu, 28 May 2009, Bulat Ziganshin wrote:

read x

Error: type of x is Integer
while type of read argument should be String

I also have my problems with "inferred/expected" and find your suggested message easier to understand in this case. But can it be generalized? I think that "inferred" and "expected" are quite arbitrary terms for the user, since he does not know, what GHC first believed to know for sure.

Prelude> let a = 'a'; b = "b" in a==b

<interactive>:1:27:
    Couldn't match expected type `Char' against inferred type `[Char]'
    ....

Is the type of 'a' wrong or that of 'b'? The compiler cannot know. It can only state that the types mismatch. The order in which it infers is not obvious for the user.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to