Opened 6 years ago

Closed 6 years ago

#5628 closed bug (fixed)

Deriving Eq on bottom types breaks reflexivity of (==)

Reported by: tinctorius Owned by:
Priority: normal Milestone:
Component: Compiler Version: 7.2.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect result at runtime Test Case: deriving/should_run/T5628
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


Related to #4220 and #4302.

{-# LANGUAGE EmptyDataDecls, StandaloneDeriving #-}
data Z
deriving instance Eq Z
g :: Z
g = g
main :: IO ()
main = print (g == g)

Observed output ((==) not reflexive anymore?):


Expected output (this is what TcGenDeriv.mkRdrFunBind does for Show etc.):

"*** Exception: Void (==)

Change History (4)

comment:1 Changed 6 years ago by tinctorius


Confirmed in 7.2.1.

comment:2 Changed 6 years ago by simonpj@…

commit 078b891f9d64c70cc72637be9e6a274275244990

Author: Simon Peyton Jones <>
Date:   Tue Nov 15 17:17:28 2011 +0000

    Fix Trac #5628: equality on data types with no constructors

 compiler/typecheck/TcGenDeriv.lhs |   27 ++++++++++++++++-----------
 1 files changed, 16 insertions(+), 11 deletions(-)

comment:3 Changed 6 years ago by simonpj

Test Case: deriving/should_run/T5628

Good point, thank you. Fixed as above.


comment:4 Changed 6 years ago by simonpj

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.