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 |