Can I disable the non-exhaustive pattern matches warning only for lambdas?
I like the warning in general, but not for actual lambda literals like this:
map (\(x:xs)->...) ls
I think this code makes it pretty clear that I expect all the values of ls to always have at least one element, and there is no neat way to handle the error case in the lambda. (I guess I could move the pattern match into a case statement, but that would just be ugly.)
Yes, but only in GHC 7.2 onwards; pass
-fno-warn-incomplete-uni-patterns(e.g. in your Cabal file’sghc-optionsfield, or in an{-# OPTIONS_GHC #-}pragma at the top of your file).However, this will also disable the warning for pattern bindings, so
let Just x = Nothing in xwon’t produce a warning.casestatements are unaffected.