
I found the handling of (IO t) by the interpreter (GHCI in my case) to be somewhat confusing. As pointed out below, I can type:
readFile "bla" :: IO String
and GHCI happily displays the contents of the file. However neither of the following work
print $ readFile "bla"
putStr $ readFile "bla"
In other words, GHCI seems perfectly willing to "unwrap" a type (IO t) and display it (assuming Show t). This bit of helpfulness may just confuse us novice users by allowing us to stray from the correct way to deal with wrapped types (monads).
content <- readFile "bla"
print content
putStr content
Terry
________________________________
From: Maria Boghiu