From: Learn You a Haskell
===================
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:
import Data.Char
main = do
putStrLn "What's your first name?"
firstName <- getLine
putStrLn "What's your last name?"
lastName <- getLine
let bigFirstName = map toUpper firstName
bigLastName = map toUpper lastName
putStrLn $ "hey " ++ bigFirstName ++ " " ++ bigLastName ++ ", how are
you?"
===================
Questions:
1) Is there an implicit *in* before the last line above?
2) Within a do "in" the IO monad (or any other monad), can a *let* do something
like this?
let x = do -- in a different monad
Michael
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe