Skip to content

Runtime error with RecordWildCards and a non-record constructor

The following program is accepted with no warning, and crashes at runtime with an error:

{-# LANGUAGE RecordWildCards #-}
newtype N = N Int deriving (Show)

main = print N{..}
% runghc wildcards.hs  
wildcards.hs: wildcards.hs:4:14-18: Missing field in record construction

I find this behavior surprising. Would it be better to either disallow it or have -fwarn-missing-fields warn it?

Trac metadata
Trac field Value
Version 7.8.3
Type FeatureRequest
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