> Philippa Cowderoy wrote:
> 
> > The ability to fail doesn't need the do notation, just use of 
> > return for success - similar for propagating failure.
> 
> I'm not sure I understand. Do you mean writing functions
> like:
> 
>     sqr x | x < 0     = fail "less than zero"
>           | otherwise = return (sqrt x)

s/fail/error/
s/return//

Then you can easily write

> I can't (easily) write
> 
>     text c = sqr x + sqr (x+1)

You just can't *catch* this outside the IO monad.

--KW 8-)
-- 
Keith Wansbrough <[EMAIL PROTECTED]>
http://www.cl.cam.ac.uk/users/kw217/
University of Cambridge Computer Laboratory.

_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to