[GHC] #8581: Pattern synonym used in an expression context could have different constraints to pattern used in a pattern context
GHC
ghc-devs at haskell.org
Mon Dec 21 09:13:24 UTC 2015
#8581: Pattern synonym used in an expression context could have different
constraints to pattern used in a pattern context
-------------------------------------+-------------------------------------
Reporter: cactus | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 8.0.1
Component: Compiler | Version:
Resolution: | Keywords:
| 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):
Let's not think about implementation before we have a ''design''. I have
not read the entire thread again, but I'm pretty convinced that
* We can't have two different types, one for construction and one for
pattern matching
I think it'll just be too confusing to have two types. It's bad enough to
have this provided/required stuff without, in addition, having a
completely separate type for construction. Are you seriously proposing to
have two signatures for each pattern synonym? (Optionally, I assume.)
So: if you give a pattern signature, I think it has to work for both
construction and pattern matching. If you need extra constraints for
construction, define a smart constructor (that can happen today with
regular data constructors).
Let's not over-elaborate until we have more experience. There are plenty
of [https://ghc.haskell.org/trac/ghc/wiki/PatternSynonyms open tickets to
tackle on the pattern-synonym front].
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/8581#comment:34>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list