How do we print the output of a function that returns an IO String to the stdout? I am not able to use show or print.
Share
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.
If you want to print the result of the function
foo :: Int -> IO String(for example), you can door, without the do-notation,
The do-notation is syntactic sugar for the second, which uses the fundamental
(>>=)combinator, which has the typeIOis an instance of theMonadclass, so you can use it here.