[GHC] #16141: StrictData and TypeFamilies regression
GHC
ghc-devs at haskell.org
Mon Jan 7 04:27:07 UTC 2019
#16141: StrictData and TypeFamilies regression
-------------------------------------+-------------------------------------
Reporter: RyanGlScott | Owner: (none)
Type: bug | Status: new
Priority: highest | Milestone: 8.8.1
Component: Compiler | Version: 8.6.3
(Type checker) |
Keywords: | Operating System: Unknown/Multiple
Architecture: | Type of failure: GHC rejects
Unknown/Multiple | valid program
Test Case: | Blocked By:
Blocking: | Related Tickets:
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
The credit goes to wuzzeb for originally discovering this bug
[https://www.reddit.com/r/haskell/comments/ad9a7k/strictdata_typefamilies_and_ghc_86/
here]. I've minimized their test case slightly below:
{{{#!hs
{-# 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`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16141>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list