<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
On page 141 of "Yet another Haskell Tutorial" (9.7 Monad Transformers)<br><br>mapTreeM action (Leaf a) = do<br>&nbsp;&nbsp;&nbsp; lift (putStrLn ("Leaf" ++ show a))<br>&nbsp;&nbsp;&nbsp; b &lt;- action a<br>&nbsp;&nbsp;&nbsp; return (Leaf b)<br>&nbsp;<br>mapTreeM :: (MonadTrans t, Monad (t IO), Show a) =&gt; (a -&gt; t IO a1) -&gt; Tree a -&gt; t IO (Tree a1)<br><br>Why does the type signature of mapTreeM look like this?<br>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?<br><br>I have no idea about the explanation in the book...is there anyone can give me some hints about this?<br>Thank you in advance!<br><br /><hr />立刻下载 MSN 保护盾,保障Messenger 安全稳定! <a href='http://im.live.cn/safe/' target='_new'>现在就下载!</a></body>
</html>