(I'm starting a new thread to focus on just this issue.)
(2) There is a strange case where an error is not reported for a missing type class instance, even though there is no (apparent) relation between the missing instance and the hole. (This also relates to the connection to `undefined', but less directly.)
Yes; GHC classifies type errors into two groups:
· insoluble (eg Int~Bool) are definitely wrong
· unsolved (eg Eq a) might be ok if (say) the context changed
If there are any insolubles (anywhere), error messages about unsolved constraints are suppressed. This is usually good; it focuses your attention on definite errors first. Let’s call the suppressed errors “suppressed erorrs”.
Now, holes are classified as “insoluble” at the moment, and that’s why all other unsolved errors are suppressed.
At the moment, if you way –XTypeHoles you get only a warning even though it’s really an error. Moreover it’s weird that the warning suppresses other error messages.
So I propose to change it so that –XTypeHoles gives an error message (for holes); and you can use –fdefer-type-errors to defer it.
In doing this I also realised that with –fdefer-type-errors you only get warnings for the things that would previously have been errors; you don’t get warnings for “supressed errors”. And that’s arguably bad, since you don’t know about all the errors you are deferring to runtime. So I’ve changed it so that with –fdefer-type-errors you get *all* errors as warnings (no supression).