[GHC] #13116: Allow Overloaded things in patterns

GHC ghc-devs at haskell.org
Fri Jan 13 20:18:47 UTC 2017


#13116: Allow Overloaded things in patterns
-------------------------------------+-------------------------------------
           Reporter:                 |             Owner:
  facundo.dominguez                  |
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.0.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 This ticket is motivated by the use of `OverloadedLabels` of the
 [http://hackage.haskell.org/package/choice-0.2.0 choice package].

 One can use a type `Choice "block"` with values `Do #block` and `Don't
 #block` by using `OverloadedLabels`. However, in patterns this syntax is
 forbidden.

 {{{
 case block of
   Do    #block -> ...
   Don't #block -> ...
 }}}

 It would be nice if overloaded labels desugared to something sensible in
 patterns, perhaps
 {{{
 case block of
   Do    ((==) (fromLabel (proxy# :: Proxy# "foo")) -> True) -> ...
   Don't ((==) (fromLabel (proxy# :: Proxy# "foo")) -> True) -> ...
 }}}

 `OverloadedLists` and `OverloadedStrings` could benefit from a similar
 solution.

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


More information about the ghc-tickets mailing list