[GHC] #12203: Allow constructors on LHS of (implicit) bidirectional pattern synonym
GHC
ghc-devs at haskell.org
Thu Aug 25 07:54:32 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):
Edward and I discussed this. What if we wrote this:
{{{
pattern VCons :: a -> Vec a n -> Vec a (n + 1)
pattern VCons x xs = Vec (x : unVec xs)
}}}
What makes it OK to use bidirectional "=" is that the RHS is invertible.
Constructors are invertible. '''But so is `unVec`''', because it's inverse
is just `Vec`.
So maybe we should just expand the class of invertible RHSs a little?
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12203#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list