On Nov 22, 2007 1:22 PM, Jonathan Cast <[EMAIL PROTECTED]> wrote:

> On 22 Nov 2007, at 10:17 AM, Maurí cio wrote:
>
> > Hi,
> >
> > If I have two computations a->IO b
> > and b->IO c, can I join them to
> > get an a->IO c computation? I imagine
> > something like a liftM dot operator.
>
> This is called Kleisli composition, by the way; it's defined as (>=>)
> in Control.Monad.
>
> jcc
>
>
Even if you didn't know about (>=>)  (I didn't, actually!), it's not too
hard to write yourself:

(>=>) :: (Monad m) => (a -> m b) -> (b -> m c) -> (a -> m c)
(>=>) f g a = f a >>= g

There's no magic, just follow the types. =)

-Brent
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to