In a Haskell tutorial I ran across the following code:
do [...]
let atom = [first] ++ rest
return $ case atom of
Note that the let expression does not have an in block. What is the scope of such a let expression? The next line?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Simply put, it’s scoped “from where it’s written until the end of the
do“.Note that within a
dostatement,letis handled differently.According to http://www.haskell.org/haskellwiki/Monads_as_computation#Do_notation , it is interpreted as follows: