[GHC] #5972: option to suppress (Monomorphic) record selector functions
GHC
ghc-devs at haskell.org
Wed Sep 7 07:12:22 UTC 2016
#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 adamgundry):
@AntC I think mpickering's point is that inside GHC, a(n unambiguous)
field label is identified by the `Name` of its selector function when used
inside curly braces. There's no real distinction between the two made by
the implementation. Changing that would be possible, but tedious.
In the post-DuplicateRecordFields implementation, it is possible to
distinguish between fields and non-fields during name resolution. Thus it
probably wouldn't be too hard to implement a variant on this whereby
enabling the extension suppressed all selector functions (local or
imported) //for expressions in the current module//, just as
DuplicateRecordFields changes the name resolution rules within a single
module. The selectors would still be generated, they just wouldn't be in
scope.
That wouldn't quite give the behaviour you describe on the wiki page with
regard to import/export, because if you exported a field then client
modules could use it as a selector (unless they enable the extension
themselves). You would have the option to hide the field and export a lens
of the same name though.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5972#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list