Skip to content

GitLab

  • Menu
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 4,869
    • Issues 4,869
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 456
    • Merge requests 456
  • 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 Compiler
  • GHCGHC
  • Issues
  • #15542
Closed
Open
Created Aug 19, 2018 by michalrus@trac-michalrus

DuplicateRecordFields not honored within a data family?

I’m observing some weird behavior, which is probably closely related to issue #15149 (closed).

The following minimized code does not compile on 8.2.1, 8.2.2, but it does compile on 8.4.3.

However, in my original (non-free) codebase, this is reversed: 8.2.2 compiles it just fine, and 8.4.3 fails with both errors per usage location at the same time:

src/.../Docs.hs:123:11: error:
    • Constructor ‘X'Y’ does not have the required strict field(s): z

...

src/.../Docs.hs:123:11: error:
    • Constructor ‘X'Y’ does not have field ‘z’

I noticed, after updating the codebase’s compiler to 8.4.3.

If the z field is renamed and unique, it compiles correctly.

How can I go about debugging/minimizing this?

This is the minimized code that works the other way round (OK on 8.4.3, fails on 8.2.2):

{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE KindSignatures #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE StrictData #-}

module Main where

data AB = A | B

class SomeClass (ab :: AB) where
  data SomeData ab

instance SomeClass 'A where
  data SomeData 'A = SomeData'A{someField :: Int} deriving Show

instance SomeClass 'B where
  data SomeData 'B = SomeData'B{someField :: Int}

main :: IO ()
main = print SomeData'A{someField = 5}
Trac metadata
Trac field Value
Version 8.4.3
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
Assignee
Assign to
Time tracking