> > I can't see how such a generalization could look like, especially since
> > "maybe" can be used with arbitrary monad:
> >     maybe (fail "Nothing") return
> 
> Well, that???s a possible implementation of a maybeToM. The question is:
> Is it useful enough for a name on it???s own?

I thought it was useful enough in genericserialize:

module Data.Generics.Serialization.Standard ...

-- |Convert a 'Maybe' object into any monad, using the imbedding defined by
-- fail and return.
fromMaybeM :: Monad m => String -> Maybe a -> m a
fromMaybeM st = maybe (fail st) return
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to