Simple question, but I can’t seem to figure it out. I have a list, and I want to print out each element of it on its own line. I can do
map show [1..10]
for example, which will print out them all together, but with no newlines. My thought was to do map (putStrLn $ show) [1..10] but this won’t work because I just get back an [IO()]. Any thoughts?
Try this:
mapM_ (putStrLn . show) [1..10]