[GHC] #11233: Improve optimisation of pattern synonym matching
GHC
ghc-devs at haskell.org
Tue Dec 15 21:16:43 UTC 2015
#11233: Improve optimisation of pattern synonym matching
-------------------------------------+-------------------------------------
Reporter: mpickering | Owner:
Type: task | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Keywords: newcomer, | Operating System: Unknown/Multiple
PatternSynonyms |
Architecture: | Type of failure: None/Unknown
Unknown/Multiple |
Test Case: | Blocked By:
Blocking: | Related Tickets: #11224
Differential Rev(s): | Wiki Page:
-------------------------------------+-------------------------------------
Currently GHC does a very poor job of optimising pattern matches which
include pattern synonyms.
It would be good to modify `sameGroup` in `compiler/deSugar/Match.hs` to
be a lot smarter about when it is safe to group two pattern matches
together.
Grouping was originally disabled as it is a bit trickier than originally
thought. See #11224 for details.
The rule was originally to group two pattern matches together `PgSyn p1`
and `PgSyn p2` when `p1 == p2`. This rule wasn't safe when `p1` had a
polymorphic return type and thus could have a different type on each
branch even though syntactically identical. A good solution to this ticket
would come up with a smarter rule about when it is and isn't safe to group
two together in the same spirit as the more complicated rules for view
patterns.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11233>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list