[GHC] #16128: Pattern match checker should shortcut on simple cases

GHC ghc-devs at haskell.org
Fri Jan 4 22:23:16 UTC 2019


#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


More information about the ghc-tickets mailing list