
19 Jun
2007
19 Jun
'07
9:55 p.m.
On Tue, Jun 19, 2007 at 11:03:46PM +0200, peterv wrote:
Haskell is known for its very strong static type checking, which eliminates a lot of runtime errors.
But the following simple program crashes at runtime:
data D = A | B
f A = True
main = print (f B)
I understand this has nothing to do with type checking, but why can't the compiler give a warning about this? Or is this by design or because it is impossible to check with more complex recursive data types?
Like all good UNIX compilers, GHC will only print warnings if you ask it to, with -Wincomplete-patterns (iirc). -Wall enables most of them, the full list is in The Glorious Glasgow Haskell Compilation System User's Guide (a valuable read!) Stefan