I have a small bit of code that isn't behaving as I expected it too:
tempTest = do
(_,tHand) <- openTempFile "." "tempTest.txt"
hPutStr tHand "Test!"
read <- hGetContents tHand
putStrLn read
It writes to the file correctly, but when asked to display the contents to the screen, it shows only a new line (without any quotes). Given how simple this is, I'm assuming I'm misunderstanding how getContents works. From what I understand, it reads the file in chunks instead of all at once; which prevents the memory from being filled up by a massive file being read. Why is "read' not receiving anything from hGetContents? Any help here would be appreciated.