1

I have an IO [String] in main, which I want to write (as lines) to stdout. How?

--newbie

1 Answer 1

9

IO [String] is an action that will get you strings. If you wish to perform the action and print the results then consider:

printIOString io = putStrLn . unlines =<< io

Or with some additional notation, if you prefer:

printIOString io =
  do strs <- io
     let rendered = unlines strs
     putStrLn rendered
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.