[Haskell-cafe] name of this monadic combinator?
Jonas Almström Duregård
jonas.duregard at gmail.com
Sun May 30 13:31:37 EDT 2010
It might be useful to relax the type of the function to
Monad m => (a -> b -> c) -> m a -> m b -> m c
/Jonas
On 30 May 2010 10:35, 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
>
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
More information about the Haskell-Cafe
mailing list