[Haskell-cafe] Composing monads
Brandon S. Allbery KF8NH
allbery at ece.cmu.edu
Thu Nov 22 14:04:24 EST 2007
On Nov 22, 2007, at 13:17 , Maurí cio wrote:
> 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.
If you have GHC 6.8.1, this is the Kleisli composition operator (>=>)
in Control.Monad. (There is also (<=<) which corresponds to (=<<).)
Prelude Control.Monad> :i (>=>)
(>=>) :: (Monad m) => (a -> m b) -> (b -> m c) -> a -> m c
-- Defined in Control.Monad
infixr 1 >=>
Prelude Control.Monad> :i (<=<)
(<=<) :: (Monad m) => (b -> m c) -> (a -> m b) -> a -> m c
-- Defined in Control.Monad
infixr 1 <=<
--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allbery at kf8nh.com
system administrator [openafs,heimdal,too many hats] allbery at ece.cmu.edu
electrical and computer engineering, carnegie mellon university KF8NH
More information about the Haskell-Cafe
mailing list