
Hi Matthew, I guess this whole ticket has been overtaken by the DuplicateRecordFields extension in GHC 8.0. This ticket was written way before SPJ and Adam arrived at that approach. There might still be some lensaholics who hanker after the namespace. For the record ...
A field label and record selector are currently the same thing.
You might think that because they are spelt the same, and one always comes with the other under H98, but actually as at H98 they're not. And
#5972: option to suppress (Monomorphic) record selector functions -------------------------------------+------------------------------------- Reporter: AntC | Owner: Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: Resolution: | Keywords: records Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by mpickering): Replying to [comment:14 AntC]: that's the point:
* a record selector is a function, first-class. If the language didn't
* a field label can only appear in specific record access contexts {inside curly braces}. It is not first-class; only syntax sugar for
create one automatically, you could do it yourself. positional access to the fields of the constructor.
I agree there are namespace concerns if a user creates their own
function with the same name (which is indeed the purpose). This chiefly affects module export/import. See the link in the OP for more detail.
It would seem that a correct solution would place field labels in a
separate namespace ...
I believe the pre-DuplicateRecordFields implementation unsugarred the
field labels so they didn't occupy a namespace atall. Perhaps the situation is now different with Overloaded labels. Hi Ant, yes, I am one of those 'lensaholics'. Adam is right that I was referring to the implementation where a field label is identified by the `Name` of the selector (in the non-overloaded case). I don't think this is related to overloaded record fields really. When I read this ticket I didn't imagine that enabling this flag would allow duplicate field labels, just suppress the generation of the field accessors. Anyway, this ticket was instructive because it showed how tightly intertwined the implementation is. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/5972#comment:16 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler