Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 5,348
    • Issues 5,348
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 574
    • Merge requests 574
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell CompilerGlasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #16141
Closed
Open
Issue created Jan 07, 2019 by Ryan Scott@RyanGlScottMaintainer

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
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking