Opened 9 years ago

Closed 9 years ago

Last modified 4 years ago

#4302 closed bug (fixed)

Impossible when deriving empty data declaration

Reported by: mitar Owned by:
Priority: normal Milestone: 7.4.1
Component: Compiler Version: 6.12.3
Keywords: Cc: mmitar@…
Operating System: Linux Architecture: x86_64 (amd64)
Type of failure: None/Unknown Test Case: deriving/should_compile/T4302
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


When trying to load following code into GHCi I get an error:

ghc: panic! (the 'impossible' happened)
  (GHC version 6.12.3 for x86_64-unknown-linux):

Code is:

{-# LANGUAGE StandaloneDeriving, EmptyDataDecls #-}
module Test where
data Test
deriving instance Show (Test)

Probably Test cannot be made instance of Show but still error should be less fatal. ;-)

Change History (3)

comment:1 Changed 9 years ago by igloo

Milestone: 7.2.1

Thanks for the report.

comment:2 Changed 9 years ago by simonpj

Resolution: fixed
Status: newclosed
Test Case: deriving/should_compile/T4302

Excellent point. This is really the same bug as #4220, but needs a more systematic fix. Done with

Mon Sep 13 18:03:55 BST 2010
  * Fix Trac #4302, plus a little refactoring

    M ./compiler/hsSyn/HsUtils.lhs -13 +1
    M ./compiler/typecheck/TcDeriv.lhs -12 +19
    M ./compiler/typecheck/TcGenDeriv.lhs -28 +48

And I added another test


comment:3 Changed 4 years ago by thomie

commit 2fc5aa708982a414235d3aff68dea4329b546063

Author: <unknown>
Date:   Mon Sep 13 17:03:55 2010 +0000

    Fix Trac #4302, plus a little refactoring
Note: See TracTickets for help on using tickets.