
18 Dec
2006
18 Dec
'06
12:22 p.m.
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