[GHC] #16128: Pattern match checker should shortcut on simple cases
#16128: Pattern match checker should shortcut on simple cases -------------------------------------+------------------------------------- Reporter: gbaz | Owner: (none) Type: feature | Status: new request | Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- I'm autogenerating with TH some code that does a giant string pattern match on up to 60 cases. This match clause includes a default case, but nonetheless I get a warning: Pattern match checker exceeded (2000000) iterations in a case alternative. (Use -fmax-pmcheck-iterations=n to set the maximun number of iterations to n) Note that in my case all the strings share a great deal in their common prefixes, which probably doesn't help matters. It seems to me that in a case like this, GHC should be able to just check that there are no duplicate strings (i.e. no overlaps) and that there is a default case (i.e. no incompleteness) rather than running the full checker algo. I'm not quite sure if there's a good way to generalize such a proposed shortcut so it is not too much of a special case, but likely something could be done? -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16128> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16128: Pattern match checker should shortcut on simple cases -------------------------------------+------------------------------------- Reporter: gbaz | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: | PatternMatchWarnings 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: => PatternMatchWarnings -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16128#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16128: Pattern match checker should shortcut on simple cases -------------------------------------+------------------------------------- Reporter: gbaz | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: | PatternMatchWarnings 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):
It seems to me that in a case like this, GHC should be able to just check that there are no duplicate strings
I agree that such a simple use-case should not make the pattern match checker have a heart attack. The pattern-match checker badly needs someone to love it. It's basically in quite good shape, with a published paper to explain how it works. But it suffers from having no active maintainer -- except the ever-energetic Ryan S, who has many other things on his radar. Who would like to do this? Many people would thank you! See [wiki:PatternMatchCheck] for a list of open tickets. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16128#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#16128: Pattern match checker should shortcut on simple cases -------------------------------------+------------------------------------- Reporter: gbaz | Owner: (none) Type: feature request | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: | PatternMatchWarnings 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 Marge Bot <ben+marge-bot@…>): In [changeset:"d97f0db8fa6c5d9a4c90c6096b01a76da07cfb2b/ghc" d97f0db/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="d97f0db8fa6c5d9a4c90c6096b01a76da07cfb2b" Fix test for T16180 on Darwin (fix #16128) }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/16128#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC