
10 Aug
2010
10 Aug
'10
12:49 p.m.
On Tue, Aug 10, 2010 at 1:40 PM, michael rice
1) Is there an implicit *in* before the last line above?
The (let ... in ...) construct is an expression, while the (let ...) inside 'do' is a statement. The (do ...) itself is an expression. See the report: http://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-440003.12 http://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-470003.14
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
Yes =). For example,
main = do -- IO monad putStrLn "Hello!" let x = do i <- [1..5] -- list monad (i.e. []) j <- [i..5] return (i*j) mapM print x
-- Felipe.