what's the deal with "user error" on fail?
Jon Cast
jcast at cate0-46.reshall.ou.edu
Thu Nov 13 13:33:28 EST 2003
David Roundy <droundy at abridgegame.org> wrote:
> i would say that if you are wanting to report errors to users, you
> should not use "fail" or "error". you should instead explicitly
> report the error. when i program i typically use "error" in
> situations that i think are imposible, but if there is a bug one gets
> a better error messeage. i don't use fail (well except sometimes
> implicitly in list comprahensions). the reason i avoid "fail" is that
> it seems hackish to me -- it implies that every monad supports errors
^^^^^^^^^^^^^^^^^^^^^^^^^^^
In Haskell, this is indeed the case---every monad is after all a monad
transformer applied to Haskell's identity monad, which supports errors
(hence the existence of Haskell's `error' function :). So even if a
monad designer doesn't explicitly add error support, the monad still
supports errors.
Jon Cast
More information about the Haskell-Cafe
mailing list