Panic when defining an instance for (~~) [ppr_equality: homogeneity]
In GHC 8.2.1 and HEAD, compiling this file panics:
import Data.Type.Equality
instance (~~) Int Int
$ /opt/ghc/8.2.1/bin/ghc Bug.hs
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Bug.hs:2:10: error:ghc: panic! (the 'impossible' happened)
(GHC version 8.2.1 for x86_64-unknown-linux):
ppr_equality: homogeneity
~~
Call stack:
CallStack (from HasCallStack):
prettyCurrentCallStack, called at compiler/utils/Outputable.hs:1133:58 in ghc:Outputable
callStackDoc, called at compiler/utils/Outputable.hs:1137:37 in ghc:Outputable
pprPanic, called at compiler/iface/IfaceType.hs:1008:31 in ghc:IfaceType
We should probably give a similar error as for when one attempts to define an instance for (~)
:
instance (~) Int Int
$ /opt/ghc/8.2.1/bin/ghc Bug.hs
[1 of 1] Compiling Main ( Bug.hs, Bug.o )
Bug.hs:1:10: error:
• Illegal instance declaration for ‘Int ~ Int’
Manual instances of this class are not permitted.
• In the instance declaration for ‘(~) Int Int’
|
1 | instance (~) Int Int
| ^^^^^^^^^^^
Trac metadata
Trac field | Value |
---|---|
Version | 8.2.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |