OverloadedRecordDot: "label" can't be used as a field name
{-# LANGUAGE OverloadedRecordDot #-}
getLabel :: D -> ()
getLabel = \x -> x.label
getLabel = (.label)
getLabel = \x -> x.label'
getLabel = (.label')
With GHC 9.2.1, The first two definitions above are parse errors. The second two are not.
I'm pretty curious to know how this has come about. Note that the behaviour is different for actual keywords like type
or data
, where we get a parse error if we even try to define them as field names (side note: it would be cool if these were valid - I can't immediately think of an actual ambiguity).
Edited by George Thomas