
#11527: Pattern match translation suboptimal -------------------------------------+------------------------------------- Reporter: augustss | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 7.8.3 Resolution: | Keywords: 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 augustss): I agree that in general we can't rearrange the tests. Unfortunately, this means that using your own string type instead of String can be quite costly if you do pattern matching (that's actually my use case). Since we can't assume that the compiler can deduce the necessary property, I suggest we add some way to convey the information. Some different ways: * Annotation on the Eq instance to say that it is sane. * Annotation on the case expression to say that we want more aggressive reordering. * A compiler flag that says we want more aggressive reordering. An annotation on the Eq instance seems like the nicest option. I'm quite keen to minimize the performance penalty for using a different string type. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/11527#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler