Non-exhaustive pattern match(es) warning in lambda functions

Mitar mmitar at gmail.com
Tue Sep 21 02:44:17 EDT 2010


Hi!

Why GHC does not warn (with -Wall) about non-exhaustive pattern
match(es) warning in lambda functions? For example, this code:

data Foo = Bar | Baz

test1 :: Foo -> IO ()
test1 Bar = return () -- Pattern match(es) are non-exhaustive warning, OK

test2 :: Foo -> IO ()
test2 = \Bar -> return () -- No pattern match(es) are non-exhaustive, BAD

I think it would be quite useful to also catch such situations and
issue a warning.


Mitar


More information about the Glasgow-haskell-users mailing list