Warn about incomplete pattern matching by default

I would like to change GHC so it defaults to warning about incomplete pattern matches, since that would be (in my opinion) the less surprising behaviour.

So I opened an issue about it:

My question is if the correct first step would be to first create a ghc-proposal?

4 Likes

I suspect some thorough discussion will be needed, as noticed in the ticket, -Werror might break some production code.

I always found incomplete patterns and variable shadowing warnings incredibly useful (as they spot bugs 99% of the times — var. shadowing tricky bugs), I always turn them on.

I agree. I would be interested in seeing the use case of enabling -Werror but not enabling -fwarn-incomplete-patterns - I have a hard time accepting that it exists tbh.

2 Likes

Interesting coincidence: Haskell: The Bad Parts, part 3 mentions this problem (better: the non-defaultedness) too.