[GHC] #11671: Allow labels starting with uppercase with OverloadedLabels

GHC ghc-devs at haskell.org
Mon Feb 12 16:47:50 UTC 2018


#11671: Allow labels starting with uppercase with OverloadedLabels
-------------------------------------+-------------------------------------
        Reporter:  inaki             |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1-rc1
  (Parser)                           |
      Resolution:                    |             Keywords:  ORF
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 dwincort):

 Just to bump this, I also have a use case for labels starting with
 uppercase letters.  Specifically, in the same way that overloaded labels
 have been used for record field selectors (lenses), my group is trying to
 use ones that start with uppercase letters for constructor selectors
 (prisms).  Although the ability to use them in patterns would be great,
 this is truly a separate issue, and we have uses for just the prisms (for
 example, as handlers in the foldl package
 [https://hackage.haskell.org/package/foldl]).

 Right now, we have a hack where overloaded labels starting with `_` are
 treated as prisms, and we write, e.g., `#_Foo` to get the prism for the
 constructor `Foo`.  Not only is this ugly, but it means that any record
 fields starting with `_` are turned into prisms instead of lenses.  Having
 labels that can start with uppercase letters would fix this.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11671#comment:15>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list