So, the problem is that test of emptiness does not force you to something right. And possible errors are:
if empty:
# do if NOT empty - BUG!
else:
# do if EMPTY - BUG TOO!
or
# do if NOT empty - BUG!
if NOT empty:
# now nothing or old "do if NOT EMPTY"
There is an opinion that Bool type has problems. It's "dangerous", because it's not good to be used as flag for success/fail result. I read this post: https://existentialtype.wordpress.com/2011/03/15/boolean-blindness/ and was shocked. How popular is such opinion? Is it true, that bool is "bad" type?To me the argument boils down to the `head` case mentioned by Alex. Most programming languages force you to write code like if List.empty l then ... else ... x = List.head l ... where the problem is that the fact that the List.head call will find the list non-empty is not obvious (in the sense that it requires reasoning). In contrast case l | nil => ... | cons x xs => ... makes it trivially obvious that `x` is extracted from a non-empty list without any reasoning needed at all. Stefan _______________________________________________ Haskell-Cafe mailing list To (un)subscribe, modify options or view archives go to: http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe Only members subscribed via the mailman list are allowed to post.