[Haskell-cafe] name of this monadic combinator?

Michael Snoyman michael at snoyman.com
Sun May 30 04:40:03 EDT 2010


On Sun, May 30, 2010 at 11:35 AM, Michael Vanier <mvanier42 at gmail.com>wrote:

> I stumbled across this monadic combinator:
>
> mcombine :: Monad m => (a -> a -> a) -> m a -> m a -> m a
> mcombine f mx my = do
>    x <- mx
>    y <- my
>    return (f x y)
>
> I used it to chain the outputs of two Parsec String parsers together using
> this operator:
>
> (<++>) :: Monad m => m String -> m String -> m String
> (<++>) = mcombine (++)
>
> mcombine seems like such a basic operation that it should be a library
> function, but I couldn't find one matching it on hoogle.  Is there one?
>
> - Mike
>
> liftM2:
http://hackage.haskell.org/packages/archive/base/4.2.0.1/doc/html/Control-Monad.html#v%3AliftM2

<file:///usr/share/doc/ghc6-doc/html/libraries/base-4.2.0.0/Control-Monad.html#v%3AliftM2>Strangely,
Hayoo didn't turn this one up... anyone know why?

Michael
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100530/2d43b56a/attachment.html


More information about the Haskell-Cafe mailing list