[GHC] #10684: Error cascade when unrelated class derivation fails

GHC ghc-devs at haskell.org
Fri Jul 24 20:36:50 UTC 2015


#10684: Error cascade when unrelated class derivation fails
-------------------------------------+-------------------------------------
              Reporter:  ezyang      |             Owner:
                  Type:  bug         |            Status:  new
              Priority:  low         |         Milestone:
             Component:  Compiler    |           Version:  7.11
  (Type checker)                     |
              Keywords:              |  Operating System:  Unknown/Multiple
          Architecture:              |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
             Test Case:              |        Blocked By:
              Blocking:              |   Related Tickets:
Differential Revisions:              |
-------------------------------------+-------------------------------------
 Pretty minor bug, but I thought I'd point it out:

 {{{
 module A where
 import Data.Typeable
 data A = A deriving (Show, Typeable)
 data B = B A deriving (Show)
 }}}

 I get two errors when I expect one:

 {{{
 A.hs:3:28:
     Can't make a derived instance of `Typeable A':
       You need -XDeriveDataTypeable to derive an instance for this class
     In the data declaration for `A'

 A.hs:4:24:
     No instance for (Show A)
       arising from the 'deriving' clause of a data type declaration
     Possible fix:
       add an instance declaration for (Show A)
       or use a standalone 'deriving instance' declaration,
            so you can specify the instance context yourself
     When deriving the instance for (Show B)

 }}}

 The failed Typeable derivation also causes the Show derivation to fail,
 which causes an error later in the file.

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


More information about the ghc-tickets mailing list