RecordWildCards implies NamedFieldPuns as of GHC 9.2
Summary
Intentionally or not, the RecordWildCards
extension appears to imply NamedFieldPuns
since GHC 9.2. This is not documented. I'm filing the issue as a bug, but it may just be a documentation oversight if the change was intentional.
Steps to reproduce
$ cat RecordWildCards.hs
{-# LANGUAGE RecordWildCards #-}
data E = MkE {a :: Int, b :: [Int]}
f MkE{a, b} = f MkE{a, b}
main = putStrLn "Compiles."
$ runghc-9.2.5 RecordWildCards.hs
Compiles.
$ runghc-9.0.2 RecordWildCards.hs
RecordWildCards.hs:5:3: error:
Illegal use of punning for field ‘a’
Use NamedFieldPuns to permit this
|
5 | f MkE{a, b} = f MkE{a, b}
| ^^^^^^^^^
...
Expected behavior
Same as GHC 9.0.2
Environment
- GHC version used: 9.2.5
Optional:
- Operating System: Fedora
- System Architecture: x86_64