generalization of maybeToList

Edward Kmett ekmett at gmail.com
Tue Feb 14 16:24:26 CET 2012


If you are going to add one then the generalization of your generalization to Alternative might be better.

maybeA = maybe empty pure

On Feb 14, 2012, at 9:55 AM, Jeff Shaw <shawjef3 at msu.edu> wrote:

> I find myself using this function quite a lot. I believe it should be included in Data.Maybe.
> 
> import Control.Monad
> 
> maybeTo :: (MonadPlus m) => Maybe a -> m a
> maybeTo =
>    maybe mzero return
> 
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries



More information about the Libraries mailing list