[GHC] #13116: Allow Overloaded things in patterns
GHC
ghc-devs at haskell.org
Fri Jan 13 20:19:38 UTC 2017
#13116: Allow Overloaded things in patterns
-------------------------------------+-------------------------------------
Reporter: | Owner:
facundo.dominguez |
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Description changed by facundo.dominguez:
@@ -18,2 +18,2 @@
- Do ((==) (fromLabel (proxy# :: Proxy# "foo")) -> True) -> ...
- Don't ((==) (fromLabel (proxy# :: Proxy# "foo")) -> True) -> ...
+ Do ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ...
+ Don't ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ...
New description:
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# "block")) -> True) -> ...
Don't ((==) (fromLabel (proxy# :: Proxy# "block")) -> True) -> ...
}}}
`OverloadedLists` and `OverloadedStrings` could benefit from a similar
solution.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13116#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list