[GHC] #8576: Improve deriving error messages

GHC ghc-devs at haskell.org
Fri Nov 29 21:25:43 UTC 2013


#8576: Improve deriving error messages
-------------------------------------------+-------------------------------
       Reporter:  nomeata                  |             Owner:  nomeata
           Type:  feature request          |            Status:  new
       Priority:  low                      |         Milestone:
      Component:  Compiler (Type checker)  |           Version:
       Keywords:                           |  Operating System:
   Architecture:  Unknown/Multiple         |  Unknown/Multiple
     Difficulty:  Unknown                  |   Type of failure:
     Blocked By:                           |  None/Unknown
Related Tickets:                           |         Test Case:
                                           |          Blocking:
-------------------------------------------+-------------------------------
 Instead of
 {{{
     No instance for (Eq (Int -> Bool))
       arising from the 'deriving' clause of a data type declaration
     Possible fix:
       add an instance declaration for (Eq (Int -> Bool))
       or use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
     When deriving the instance for (Eq Foo)
 }}}
 for
 {{{
 data Foo = Foo Int (Int -> Bool, Bool) deriving Eq
 }}}
 we want something like
 {{{
     No instance for (Eq (Int -> Bool))
       arising from the second field of the constructor Foo
     Possible fix:
       add an instance declaration for (Eq (Int -> Bool))
       or use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
     When deriving the instance for (Eq Foo)
 }}}
 where we tell the user more precisely from where in its data type the
 problem comes from. Should be possible by beefing up `CtOrigin`.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8576>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list