Pattern match checker should shortcut on simple cases
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?
Trac metadata
| Trac field | Value |
|---|---|
| Version | 8.6.3 |
| Type | FeatureRequest |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |