Skip to content

RecordWildCards doesn't work properly in repl

Prelude> :set -XRecordWildCards
Prelude> data Test = Test { t1 :: Int, t2 :: Int } deriving Show
Prelude> t1 = 2
Prelude> Test { t2 = 2, ..}

<interactive>:15:1: warning: [-Wmissing-fields]
     Fields of 'Test' not initialised: t1
     In the expression: Test {t2 = 2, ..}
      In an equation for 'it': it = Test {t2 = 2, ..}

<interactive>:15:1: warning: [-Wmissing-fields]
     Fields of 'Test' not initialised: t1
     In the expression: Test {t2 = 2, ..}
      In an equation for 'it': it = Test {t2 = 2, ..}
Test {t1 = *** Exception: <interactive>:15:1-18: Missing field in record construction t1

I would expect above to return Test {t1 = 2, t2 = 2} instead of throwing an error.

Trac metadata
Trac field Value
Version 8.2.1
Type Bug
TypeOfFailure OtherFailure
Priority lowest
Resolution Unresolved
Component GHCi
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