[Haskell-cafe] Some random newbie questions
simonpj at microsoft.com
Fri Jan 7 04:20:44 EST 2005
| * As far as I can determine, there is no way to check pattern matches
| exhaustiveness. Coming from OCaml, this feels like losing a
| safety net! How do people program so as not to be getting dynamic
| failures all the time?
GHC has -fwarn-incomplete-patterns and -fwarn-overlapped-patterns. But
the code implementing these checks is old and crufty, and the warnings
are sometimes a bit wrong -- at least when guards and numeric literals
are involved. I think they are accurate when you are just using
"ordinary" pattern matching.
Cleaning up this bit of GHC is a long-standing to-do item, if anyone
feels motivated to undertake it. It's a well-defined task, with plenty
of well-written papers explaining how to do it -- but it's tricker than
it seems at first!
More information about the Haskell-Cafe