[Haskell-cafe] About the Monad Transformers
stircrazynemo at hotmail.com
Wed Jun 17 11:54:16 EDT 2009
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!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe