On Mon, Jun 14, 2004 at 05:41:03PM +0100, Keith Wansbrough wrote: > > 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//
better yet, import Control.Monad.Identity sqr' x = runIdentity (sqr x) now sqr' behaves exactly as if you used 'error' and direct code, but the monadic version is still available for those that care about it. John -- John Meacham - ârepetae.netâjohnâ _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell