[GHC] #14112: bang patterns on pattern synonyms? (left vs right hand sides)
GHC
ghc-devs at haskell.org
Mon Aug 14 01:46:31 UTC 2017
#14112: bang patterns on pattern synonyms? (left vs right hand sides)
-------------------------------------+-------------------------------------
Reporter: carter | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.2.1
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: |
-------------------------------------+-------------------------------------
Changes (by RyanGlScott):
* keywords: => PatternSynonyms
Comment:
I'm not surprised that putting bang patterns on the left-hand side of a
pattern synonyms doesn't work. After all, the left-hand side simply binds
pattern variables. No more, no less.
I am surprised, however, that putting bang patterns on the //right//-hand
side does work. Especially since the right-hand sides of simply
bidirectional pattern synonyms are supposed to be valid expressions, and
`JustC !a` certainly doesn't feel like one.
Curiously, the users' guide documentation is quite silent about the
relationship between simply bidirectional pattern synonyms and bang
patterns. To fix this quandary, we could either:
1. Disallow bang patterns entirely on the right-hand sides of simply
bidirectional pattern synonyms (like we do with wildcard patterns and view
patterns).
2. Document the current behavior as expected. `JustC !a` is bit strange-
looking from an expression standpoint, but at the same time, it does work
and accomplishes a useful task, so perhaps we shouldn't throw the baby out
with the bathwater.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14112#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list