Empty record update [GHC-20825]
Record update syntax, in which only certain fields are replaced in a record, requires that at least one field update be specified.
Examples
No fields updated
Message
NoFields.hs:7:6: error: [GHC-20825]
Empty record update
|
7 | r2 = r1 {}
| ^^^^^
Explanation
No fields were provided in the update to r1
. Provide a field to fix the error.
NoFields.hs
Before
module NoFields where
data Record = Record {a :: Int}
r1 = Record {a = 5}
r2 = r1 {}
After
module NoFields where
data Record = Record {a :: Int}
r1 = Record {a = 5}
r2 = r1 {a = 7}