Opened 7 years ago

Closed 7 years ago

Last modified 3 years ago

#7255 closed bug (fixed)

Wrong suggestion when deriving Generic on an instantiated type

Reported by: dreixel Owned by: dreixel
Priority: normal Milestone:
Component: Compiler Version: 7.6.1
Keywords: Generics Cc: nfrisby
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case: GenCannotDoRep0
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


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.

Change History (4)

comment:1 Changed 7 years ago by nfrisby

Cc: nfrisby added

comment:2 Changed 7 years ago by jpm@…

commit a17da16f08ae24e24ebe671d0731c43b240008f5

Author: Jose Pedro Magalhaes <>
Date:   Fri Sep 21 10:40:24 2012 +0100

    FIX #7255: print tyConTyVars tc, not tc_args

 compiler/typecheck/TcGenGenerics.lhs |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

comment:3 Changed 7 years ago by dreixel

Resolution: fixed
Status: newclosed
Test Case: GenCannotDoRep0

Fixed. Turns out we even had a test for this already, and somehow were accepting the wrong output; fixed that too.

comment:4 Changed 3 years ago by RyanGlScott

Keywords: Generics added
Note: See TracTickets for help on using tickets.