| > 1.Fix up the current version.
| >     use MonadZero for do expressions with *irrefutable* patterns
| >     (instead of *unfailable* patterns as now)
| > 2.Nuke MonadZero altogether.
| >     add mfail :: m a  to Monad instead

There is another variation on 2 that you don't seem to be considering:
 - Retain MonadZero
   (So you don't break existing code using MonadZero)

 - Add mfail :: m a to Monad, with a default definition like
   mfail = error "fail", and prelude definitions of mfail = [] and
   mfail = Nothing, for lists and Maybe, respectively.
   (So everything works as you'd expect without changing user code)

 - Define the semantics of do notation solely in terms of the operators
   of the (revised) Monad class, >>=, return, and mfail.
   (So types don't change when you use tuples, add extra constructors, etc.)

A happy compromise between the alternatives you give?

All the best,
Mark


Reply via email to