what's the deal with "user error" on fail?

Jon Cast jcast at cate0-46.reshall.ou.edu
Thu Nov 13 19:37:25 EST 2003


David Roundy <droundy at abridgegame.org> wrote:
> hello,
> well that's because haskell is not as pure as it claims to be :-)

Nonsense.  Haskell is perfectly pure; the IO monad is just
nondeterministic :)

> if every monad supports errors depends on what you mean by "supporting
> errors".

I mean `supporting errors' in the only possible sense that `supporting
errors' can be implied by the existence of `fail': we have a throw
function.

> i would argue that supporting errors and divergence is not the same
> thing.

I never said it was.

> the difference is that one should be able to handle an error thrown by
> a computation,

Although this doesn't imply the existence of a `catch' HOF; see the
MonadPlus instance for Maybe.

> while clearly we cannot detect nonterminating computations.

Of course.  But we can detect exceptions thrown by `error'.  Even though
we can't distinguish them from non-termination /in pure Haskell/.  We
can of course distinguish them in the IO monad (which perhaps ought to
be re-named the SinBin monad, to be more honest...).  So we can detect
erroneous computations in any monad.

Jon Cast


More information about the Haskell-Cafe mailing list