Skip to content

Wrong suggestion when deriving Generic on an instantiated type

The following code

{-# LANGUAGE DeriveGeneric      #-}
{-# LANGUAGE StandaloneDeriving #-}
{-# LANGUAGE FlexibleInstances  #-}

import GHC.Generics

data A a

data B

deriving instance Generic (A B)

gives rise to the error

    Can't make a derived instance of `Generic (A B)':
      A must not be instantiated; try deriving `A B' instead
    In the stand-alone deriving instance for `Generic (A B)'

It should indeed fail, but the suggestion should be to try deriving A a instead.

Trac metadata
Trac field Value
Version 7.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
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