I agree regarding Maybe, but in the long run, I really think we should bring back MonadZero. This issue comes up all the time because there's not really a proper class for monads that do handle failure gracefully any more. I personally consider 'fail' to be a wart, and mostly try to ignore that it even exists. Monad really isn't the class for expressing computations which might fail. - Cale On 27/06/07, Iavor Diatchki <iavor.diatchki@gmail.com> wrote:
Hi, I can see how this function can be useful. However, I am strongly opposed to adding the general monadic version---not all monads support graceful failure, and for monads that do not support it, the only option is to throw a run-time exception, which is at odds with the purity of Haskell (which leads to headaches when you try to write robust code). I think that the "Maybe" version is perfectly adequate but if we have to have an overloaded version, then we should use "MonadPlus". -Iavor
On 6/26/07, Bryan O'Sullivan <bos@serpentine.com> wrote:
Chris Smith wrote:
Hmm. That would replace a function I write today if only it were:
+1 on the monadic variant, of which I have a copy just like Chris's.
<b