I think this is a similar 'failure to deduce' partiality as last week's thread; but the other way round (and with ViewPatterns) -- at GHC 8.10.7:
GHCi> :set -XViewPatterns
GHCi> :set -Wincomplete-patterns -- also warns overlapping
GHCi> (\x -> case x of {((\(Just j) -> j) -> j2) -> j2; Nothing -> 'N'}) Nothing
===> <interactive>: warning: [-Woverlapping-patterns]
Pattern match is redundant
In a case alternative: Nothing -> ...
*** Exception: <interactive>:16:21-34: Non-exhaustive patterns in lambda
(Same Warning then same Exception if I compile the code.)
So GHC isn't smart enough, despite the explicit `(\(Just j) -> ...)`, to see that ViewPattern usage is incomplete?
I thought ViewPatterns got desugarred into clunky chains of nested `case`s, so that the pattern coverage checker could see what's going on? I was testing this because if anything I expected it to report coverage was incomplete.
To get both a claim "Pattern match is redundant" and "Non-exhaustive" seems particularly unhelpful.
AntC