#2994: give better error messages for instance declarations with the wrong 
number
of parameters
-----------------------------+----------------------------------------------
Reporter:  rwbarton          |          Owner:                  
    Type:  feature request   |         Status:  new             
Priority:  normal            |      Component:  Compiler        
 Version:  6.11              |       Severity:  normal          
Keywords:                    |       Testcase:                  
      Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
-----------------------------+----------------------------------------------
 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2994>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to