Is ‘should now be history’ premature? RecordWildCards
has been supported from GHC 6.8.1 but OverloadedRecordDot
and OverloadedRecordUpdate
are only supported from GHC 9.2.1 and the latter comes with an ‘EXPERIMENTAL’ warning in the documentation for GHC 9.2.1 to GHC 9.8.1.
Am I right to understand that, to get its full syntax benefits, moving from RecordWildCards
to record dot syntax involves, in practice, the renaming of fields to remove the prefixes that identify the type? Taking my Stack code base example:
Step 1: just use a dot syntax:
-- | Interprets BuildOptsMonoid options.
buildOptsFromMonoid :: BuildOptsMonoid -> BuildOpts
buildOptsFromMonoid buildMonoid = BuildOpts
{ boptsLibProfile = fromFirstFalse
(buildMonoid.buildMonoidLibProfile <>
FirstFalse (if tracing || profiling then Just True else Nothing))
...
-- 26 other fields relying on the 31 fields of a `BuildOptsMonoid` value
...
, boptsDdumpDir = getFirst buildMonoid.buildMonoidDdumpDir
}
where
...
Step 2: also eliminate the use of prefixes in field names to identify the type:
-- | Interprets BuildOptsMonoid options.
buildOptsFromMonoid :: BuildOptsMonoid -> BuildOpts
buildOptsFromMonoid buildMonoid = BuildOpts
{ libProfile = fromFirstFalse
(buildMonoid.libProfile <>
FirstFalse (if tracing || profiling then Just True else Nothing))
...
-- 26 other fields relying on the 31 fields of a `BuildOptsMonoid` value
...
, ddumpDir = getFirst buildMonoid.ddumpDir
}
where
...
Currently, there are 118 instances of {..}
in the Stack project: 39 in the pantry
library and 79
in Stack itself. I am happy to work through eliminating all of them but I read the guidance in the GHC documention as saying, in terms, ‘hold off from doing that - things may change’.