[Haskell-cafe] Re: [Haskell] ANNOUNCE: control-monad-exception 0.5
with monadic call traces
lemming at henning-thielemann.de
Mon Dec 7 05:23:26 EST 2009
> Henning Thielemann escribió:
>> It seems again to me, that mixing of (programming) errors and
>> exceptions is going on, and I assumed that the purpose of
>> control-monad-exception is to separate them in a better way.
> You know, could you tell me when using head on an empty list is a
> programming error and when it is a exception, I have seen both cases...
The case of (head ) is simple: It is a programming error, since the
precondition for calling 'head' is that the argument list is non-empty.
The caller of 'head' is responsible to check this. If the list comes
from user input, then the program part that receives this list from the
user is responsible to check for the empty list before calling 'head'.
If there is no such check, this is a programming error, and it will not
be possible to handle this (like an exception). Before you answer: "What
about web servers?", please read on the article I have written recently
to sum up the confusion about errors and exceptions:
More information about the Haskell-Cafe