Should exhaustiveness testing be on by default?
nr at eecs.harvard.edu
Mon May 18 16:00:07 EDT 2009
> ... exhaustive pattern checking might well help out a lot of
> people coming from untyped backgrounds...
Or even people from typed backgrounds. I worship at the altar of
> Anyone know why it isn't the default?
I have been bleating to GHC Central about the generally low level of
the default warnings. I even accused them of being tarred with the
same brush as Richard Stallman! Their (reasonable) response was that
they would rather wait for the user community to reach a consensus on
exactly *which* warnings should be on by default. I myself like to
compile with -Wall -fno-warn-name-shadowing, but I recognize that
these are questions about which reasonable people could differ.
I think if we could reach a consensus on the list, we might see a
stronger level of warnings in 6.12.
P.S. The exhaustiveness checker does need improvement, and it is
completely unaware of GADT's. My code is littered with pattern
matches where the last case is
foo _ = can't match
can't_match :: a
can't_match = panic "the GADT pattern matcher is too stupid to live"
I would really like to get rid of these. I hate wildcard matches, but
I can't put in the constructors because they don't typecheck. And if
I put in nothing, the exhaustiveness checker bleats. And I typically
compile with -Werror.
More information about the Glasgow-haskell-users