On Tuesday 10 August 2010 19:12:57, michael rice wrote: > OK, then there's also an implicit *in* after the *let* in this code.
Yes. do let x = foo bar baz is desugared to let x = foo in (bar >> baz) > Must the implicit (or explicit) *in* actually use the calculated > value(s)? No, and if the values aren't used, they're not calculated (unless you force the calculation in the bindings, e.g. with bangs). > > And, the monad can "continue on" after the *let* (with or without the > *in*) as below, i.e., the *let* needn't be the last statement in the > *do*? It *mustn't* be the last statement; the last statement in a do-block must be an expression (return blah, putStrLn whatever, ...) > > main = do > gen <- getStdGen > let code = genCode gen > putStrLn $ "Code is " ++ show code > putStrLn "..." > > > Michael _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe