
23 Nov
2007
23 Nov
'07
4:08 a.m.
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.
You've already been shown the >=> operator and how to define it from >>= by other answers. Just for variety, here is how you would define it using do notation: compose :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c compose act act' a = do b <- act a act' b Jules