Skip to content

Impossible error when deriving lower-cased type class (nameModule show{tv a9Y})

I had a student who incorrectly typed 'deriving (show)' instead of 'deriving (Show)', and got a very interesting error, as shown below. It happens in both ghc and ghci. The file should of course be rejected, but perhaps with a different error message.

$ cat Bug.hs module Types where data FuelEfficiency = MPG Float | LPHK Float deriving (show) $ ghc Bug.hs [1 of 1] Compiling Types ( Bug.hs, Bug.o ) ghc: panic! (the 'impossible' happened)

(GHC version 7.4.2 for x86_64-unknown-linux):

nameModule show{tv a9Y}

Trac metadata
Trac field Value
Version 7.4.2
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