i have a problem, this code dont work and i dont know why:
foo :: [String] -> IO [String]
foo input = do
choice <- getLine
if choice == "1" then do
putStrLn "good choice"
return input
else
return []
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.
As is (with a bit of retabbing) the code works for me. if/else is difficult to get correct with the tabs. The Wiki article if/then/else should help.
Eliminating the inner
doexpression makes the if/then block a little more easy to indent.