Closed zgotsch closed 8 years ago
So when we show an error message, we need to "realias" things. Since CounterId
is just an alias for Int
in your code, type inference will treat it just like an Int
. This means that at some point we have to figure out if any particular Int
should be displayed to the user as CounterId
or whatever else.
This also means that you can realias too aggressively. If we display all ints as a CounterId
we would have the inverse of this issue (and have had it in other releases!) which I think is actually way worse. So this feature has to be implemented very carefully to get a good experience in all cases.
Point is, I think it's plausible to call this a bug, but given how we are organizing our repos, I think it'd make the most sense to retarget this to this repo which is all about improving error messages in Elm. The plan is to gather a bunch of reports such that I can go through in one big batch and fix all the interrelated stuff. Do you mind closing this here and retargeting to that repo?
Will do! Thanks, Evan.
Moved to elm-lang/error-message-catalog.
Cool, thank you :)
I am working through the Elm architecture tutorial and I was getting an unhelpful unification error message from the compiler. When reporting the expected types and the encountered type, they did not match what I expected from the code.
Here is the code which is causing the error:
The lambda is returning a
Counter.Model
when it should be returning a(CounterId, Counter.Model)
, but the error message says:I don't understand why it is saying
(Int, Int)
andInt
in the error message, instead of(CounterId, Counter.Model)
andCounter.Model
. Fixing the type of the lambda causes these messages to disappear.P.S. There is also an error for the function not matching the signature which gives the same types: