Skip to content

Error cascade when unrelated class derivation fails

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.

Trac metadata
Trac field Value
Version 7.11
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information