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

David Roundy
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

hello, well that's because haskell is not as pure as it claims to be :-) if every monad supports errors depends on what you mean by "supporting errors". i would argue that supporting errors and divergence is not the same thing. the difference is that one should be able to handle an error thrown by a computation, while clearly we cannot detect nonterminating computations. bye iavor Jon Cast wrote:
David Roundy
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 _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- ================================================== | Iavor S. Diatchki, Ph.D. student | | Department of Computer Science and Engineering | | School of OGI at OHSU | | http://www.cse.ogi.edu/~diatchki | ==================================================

Hello guys, any one aware of a Sockets howto for haskell ? Greets, Jad
participants (3)
-
Iavor S. Diatchki
-
Jad Saklawi
-
Jon Cast