StrictData and TypeFamilies regression
The credit goes to wuzzeb for originally discovering this bug here. I've minimized their test case slightly below:
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
module Bug where
data family T
newtype instance T = MkT Int deriving Eq
With optimization enabled, this program compiles with GHC 8.0.2 through 8.4.4, but not with 8.6.3 or HEAD:
$ /opt/ghc/8.4.4/bin/ghc -fforce-recomp -O Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
$ /opt/ghc/8.6.3/bin/ghc -fforce-recomp -O Bug.hs
[1 of 1] Compiling Bug ( Bug.hs, Bug.o )
Bug.hs:6:39: error:
• Couldn't match a lifted type with an unlifted type
arising from the coercion of the method ‘==’
from type ‘GHC.Prim.Int# -> GHC.Prim.Int# -> Bool’
to type ‘T -> T -> Bool’
• When deriving the instance for (Eq T)
|
6 | newtype instance T = MkT Int deriving Eq
| ^^
Based on the error message, it appears as if GHC mistakenly believes that the representation type of the T
instance is Int#
, rather than Int
.
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | highest |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |