I just updated a project to GHC 9.2.4 and some modules raise the ambiguous-fields warning.
Reading about -XDuplicateRecordFields, I understand it is necessary to disambiguate same field names in different types when used as selectors.
But this code:
import Data.Aeson
customDefaultOptions :: Options
customDefaultOptions = defaultOptions {omitNothingFields = True}
newtypeOptions :: Options
newtypeOptions = customDefaultOptions {unwrapUnaryRecords = True}
Also raises it:
The record update customDefaultOptions
{unwrapUnaryRecords = True} with type Options is ambiguous.
This will not be supported by -XDuplicateRecordFields in future releases of GHC.
|
7 | newtypeOptions = customDefaultOptions {unwrapUnaryRecords = True}
| ^^^^^^^^^^^^^^^^^^^^^^^^^
Yet, customDefaultOptions is of type Options, like defaultOptions, where is the ambiguity?