On 15/12/2010 04:01, Jonathan Geddes wrote:
Fail can't just be removed. That would just break too much code. For
example, I find myself writing code like the following:

[a,b,c]<- Just someList

in place of

let [a,b,c] = someList

so that pattern match failure is "lifted" into the maybe monad (as
long as I'm already in the maybe monad).

I would like to see a MonadFail class, with one method 'fail', such
that it is a compile-time error to try 'failable' pattern matches in a
monad that is not an instance of MonadFail.

--Jonathan

Perhaps pattern match failures in a MonadPlus should bind to mzero - I believe that this is what your example and similar wish to achieve.

I've updated http://haskell.org/haskellwiki/Functor-Applicative-Monad_Proposal to mention this. Does anyone know why fail and Pointed (in the paragraph "This would eliminate...") aren't beginning a new paragraph? They are both preceded by a blank line in the wiki source.


_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to