Skip to content

Warning for incomplete record field label used as function

Consider the following definition:

data Foo = Bar { frob :: Int }
         | Baz { frob :: Int, quux :: Bool }

It would be great if GHC could produce a warning if I use quux as a function somewhere in my code, as calling quux on a Foo constructed with Bar will cause a runtime error. On the other hand, every use of frob is OK.

Currently, to find such problems, I have to first figure out which field labels are incomplete and then search for those, ignoring their uses as a proper field label (in construction or pattern matching).

Trac metadata
Trac field Value
Version 7.7
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