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

Iavor S. Diatchki diatchki at cse.ogi.edu
Thu Nov 13 15:51:22 EST 2003


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 <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
>_______________________________________________
>Haskell-Cafe mailing list
>Haskell-Cafe at 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               |
==================================================




More information about the Haskell-Cafe mailing list