[Haskell-cafe] Avoiding "Non-exhaustive patterns in function f"

peterv bf3 at telenet.be
Tue Jun 19 17:03:46 EDT 2007

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?






-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20070619/2e56dcaa/attachment.htm

More information about the Haskell-Cafe mailing list