Re: [Haskell-cafe] maybeToM

2006-12-19 Thread Tomasz Zielonka
On Mon, Dec 18, 2006 at 04:59:45PM +, Joachim Breitner wrote: > Well, that???s a possible implementation of a maybeToM. The question is: > Is it useful enough for a name on it???s own? OK, I agree it's sufficiently useful, and it's a generalization of Data.Maybe.maybeToList. Perhaps we could g

Re: [Haskell-cafe] maybeToM

2006-12-19 Thread Bjorn Bringert
On 18 dec 2006, at 18.22, Stefan O'Rear wrote: 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 f

Re: [Haskell-cafe] maybeToM

2006-12-18 Thread Joachim Breitner
Hi, Am Montag, den 18.12.2006, 09:22 -0800 schrieb Stefan O'Rear: > 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 (fa

Re: [Haskell-cafe] maybeToM

2006-12-18 Thread Joachim Breitner
Hi, Am Montag, den 18.12.2006, 18:12 +0100 schrieb Tomasz Zielonka: > On Mon, Dec 18, 2006 at 04:59:45PM +, Joachim Breitner wrote: > > Well, that???s a possible implementation of a maybeToM. The question is: > > Is it useful enough for a name on it???s own? > > ...and for putting it in Prelu

Re: [Haskell-cafe] maybeToM

2006-12-18 Thread Stefan O'Rear
> > 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

Re: [Haskell-cafe] maybeToM

2006-12-18 Thread Tomasz Zielonka
On Mon, Dec 18, 2006 at 04:59:45PM +, Joachim Breitner wrote: > Well, that???s a possible implementation of a maybeToM. The question is: > Is it useful enough for a name on it???s own? ...and for putting it in Prelude? It would be interesting to try to estimate the number of functions useful

Re: [Haskell-cafe] maybeToM

2006-12-18 Thread Joachim Breitner
Hi, Am Montag, den 18.12.2006, 17:42 +0100 schrieb Tomasz Zielonka: > On Mon, Dec 18, 2006 at 09:29:24AM +, Joachim Breitner wrote: > > dons mentions in his blog post that Data.Map???s lookup is generalized > > over the Monads, whereas Prelude.maybe isn???t. Are there good reasons not > > to d

Re: [Haskell-cafe] maybeToM

2006-12-18 Thread Tomasz Zielonka
On Mon, Dec 18, 2006 at 09:29:24AM +, Joachim Breitner wrote: > dons mentions in his blog post that Data.Map???s lookup is generalized > over the Monads, whereas Prelude.maybe isn???t. Are there good reasons not > to do that to Prelude.maybe as well? I can't see how such a generalization could

[Haskell-cafe] maybeToM

2006-12-18 Thread Joachim Breitner
Hi, dons mentions in his blog post that Data.Map’s lookup is generalized over the Monads, whereas Prelude.maybe isn’t. Are there good reasons not to do that to Prelude.maybe as well? Alternatively, how about adding this function to Data.Maybe, analogous to maybeToList > maybeToM Nothing = fail