Skip to content

"deriving" seems to ignore class context for a type family

class Foo a where
  data Bar a :: *

class (Show (Bar a)) => Qux a
data (Qux a) => Xyzzy a = Xyzzy (Bar a) deriving Show

Here I get the following error:

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

Curiously, I get the same error even if I add ", Show (Bar a)" to the context of "Xyzzy".

Trac metadata
Trac field Value
Version 7.0.2
Type Bug
TypeOfFailure OtherFailure
Priority normal
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