On page 141 of "Yet another Haskell Tutorial" (9.7 Monad Transformers)

mapTreeM action (Leaf a) = do
    lift (putStrLn ("Leaf" ++ show a))
    b <- action a
    return (Leaf b)
 
mapTreeM :: (MonadTrans t, Monad (t IO), Show a) => (a -> t IO a1) -> Tree a -> 
t IO (Tree a1)

Why does the type signature of mapTreeM look like this?
And what does it mean by "The lift tell us that we're going to be executing a 
command in an enclosed monad. In this case the enclosed monad is IO"? Why does 
the author put lift here? How does the lift work?

I have no idea about the explanation in the book...is there anyone can give me 
some hints about this?
Thank you in advance!

_________________________________________________________________
Messenger10年嘉年华,礼品大奖等你拿!
http://10.msn.com.cn
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to