[Haskell] Long live Edison
john at repetae.net
Mon Feb 20 19:03:07 EST 2006
On Mon, Feb 20, 2006 at 04:22:19PM -0500, Robert Dockins wrote:
> Sorry for replying to myself....
> There are a number of methods which take a monad context and call
> 'fail' (rather than error) under some conditions, usually when the
> data structure is empty, e.g.
> lview :: Monad m => s a -> m (a, s a)
> Separate a sequence into its first (leftmost) element and the
> remaining sequence. Calls fail if the sequence is empty.
> I am considering moving to a MonadPlus context and calling 'mzero' in
> the failure case. For the Maybe and List monads, the results are the
> same. In general I like using MonadPlus better, but mplus doesn't
> take a string message like fail does. Thoughts?
I very strongly depend on that string error message. It would be a bad
thing to loose it. Monad failure also feels more appropriate to me,
there isn't really an 'mplus' you are going to use so making it the
mzero just doesn't feel right.
John Meacham - ⑆repetae.net⑆john⑈
More information about the Haskell