give better error messages for instance declarations with the wrong number of parameters
Consider the following erroneous program which tries to define an instance of MonadReader
.
import Control.Monad.Reader
newtype Reader' r a = Reader' (r -> a)
instance MonadReader (Reader' r)
This instance declaration is wrong, because the MonadReader
type class has two parameters. But ghc's error message is not very helpful:
/tmp/err.hs:5:21:
`Reader' r' is not applied to enough type arguments
Expected kind `*', but `Reader' r' has kind `* -> *'
In the instance declaration for `MonadReader (Reader' r)'
While if I give too many arguments, e.g., instance MonadReader r r (Reader' r)
, I always get a good error message, even if the kinds of some of the leading types are wrong:
Kind error: `MonadReader' is applied to too many type arguments
In the instance declaration for `MonadReader r r (Reader' r)'
So it'd be great if the error message for giving too few type arguments could be more like that one.
Trac metadata
Trac field | Value |
---|---|
Version | 6.11 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |