<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><br>From: Learn You a Haskell<br><br>===================<br><br>Remember let bindings? If you don't, refresh your memory on them by reading this section. They have to be in the form of let bindings in expression, where bindings are names to be given to expressions and expression is the expression that is to be evaluated that sees them. We also said that in list comprehensions, the in part isn't needed. Well, you can use them in do blocks pretty much like you use them in list comprehensions. Check this out:<br><br><br>&nbsp; import Data.Char &nbsp;<br>&nbsp;&nbsp;&nbsp; &nbsp;<br>&nbsp;&nbsp;&nbsp; main = do &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; putStrLn "What's your first name?" &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; firstName &lt;- getLine &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; putStrLn "What's your last name?" &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
lastName &lt;- getLine &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; let bigFirstName = map toUpper firstName &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bigLastName = map toUpper lastName &nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; putStrLn $ "hey " ++ bigFirstName ++ " " ++ bigLastName ++ ", how are you?"<br><br>===================<br><br>Questions:<br><br>1) Is there an implicit *in* before the last line above?<br><br>2) Within a do "in" the IO monad (or any other monad), can a *let* do something like this?<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; let x = do &nbsp; -- in a different monad<br><br><br>Michael <br><br></td></tr></table><br>