Over eager non-exhaustive pattern match warnings in lambda expressions.
When I write:
let thing = (\(Just x) -> x) whatever
in rest
GHC shouldn't complain about non-exhaustive pattern matches for this code, because the form of the expression makes it obvious that some patterns are not being matched. The above fragment should behave like:
let thing = let Just x = whatever in x
in rest
This pattern is also non-exhaustive, but that's obvious from the form of the expression. I use both of these forms all the time because the alternative of using something like fromJust
gives bad error messages when it fails.
Here's a more concrete example from DDC:
let vks' = map (\(T.TVar k (T.UVar v')) -> (v', k))
$ map toCoreT cts
To update my code to work with 7.0.1 I have to change all of these to:
let vks' = map (\tt -> let T.TVar k (T.UVar v') = tt in (v', k))
$ map toCoreT cts
This is longer, uglier, and requires the introduction of the dummy variable tt
Trac metadata
Trac field | Value |
---|---|
Version | 7.0.1 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |