[GHC] #9815: Runtime error with RecordWildCards and a non-record constructor
GHC
ghc-devs at haskell.org
Thu Nov 20 04:17:36 UTC 2014
#9815: Runtime error with RecordWildCards and a non-record constructor
-------------------------------------+-------------------------------------
Reporter: akio | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.3
Keywords: RecordWildCards, | Operating System:
warning | Unknown/Multiple
Architecture: Unknown/Multiple | Type of failure: GHC
Difficulty: Unknown | accepts invalid program
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
The following program is accepted with no warning, and crashes at runtime
with an error:
{{{#!hs
{-# 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?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9815>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list