Use optimizer for more information about incomplete pattern matches
This mail gave me an idea that was too cute not to write down (though I don't expect it to be implemented any time soon), http://www.haskell.org/pipermail/haskell-cafe/2013-April/107775.html
The observation is that the typechecking phase is not necessarily the best point in time to check for pattern coverage exhaustiveness: if we tentatively stub in a default case with an error, and after optimization passes, we find that this case has been eliminated, then in fact there was no pattern coverage incompleteness. So, the strategy would be to defer reporting certain coverage failures until we can do actually check if there are any problems later. Obviously if no predicates or view patterns (or similar things) are involved, then there is no point in attempting to defer it, but otherwise this could help reduce warnings in code that make heavy use of these features.
Trac metadata
Trac field | Value |
---|---|
Version | 7.7 |
Type | FeatureRequest |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler (Type checker) |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |