
27 Jun
2007
27 Jun
'07
1:04 a.m.
iavor.diatchki:
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
And in the dlist library we provide, maybeToMonadPlus :: MonadPlus m => Maybe a -> m a maybeToMonadPlus = maybe mzero return For those who want it. (Maybe *that* should be in Data.Maybe). -- Don