[GHC] #12203: Allow constructors on LHS of (implicit) bidirectional pattern synonym
GHC
ghc-devs at haskell.org
Thu Aug 25 22:00:14 UTC 2016
#12203: Allow constructors on LHS of (implicit) bidirectional pattern synonym
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner:
Type: feature request | Status: new
Priority: low | Milestone:
Component: Compiler (Type | Version: 8.0.1
checker) | Keywords:
Resolution: | PatternSynonyms
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 simonpj):
Great or not, it's pretty simple. Adding newtype patterns on the left is
really quite tricky. It took me 15 mins to grok.
As to the parser, it parses patterns as expressions, and then converts
them to patterns. Then the patsyn code converst it back (for
bidirectional). So maybe we should leave it as an expression! The rule
is still simple: to use it as an expression, just use the exression. To
use it as a pattern, just treat `unVec e` as the view pattern `(Vec ->
e)`.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12203#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list