
25 Jun
2011
25 Jun
'11
9:21 a.m.
I had thought hGetContents was lazy IO. If so, will that even work? The handle to the file will be closed before much of the file is even read.
Antoine
My guess is that the code I gave, which honestly is bad because I forgot about readFile, is probably lazy rather than strict because according to [0], readFile is lazy despite the fact that it doesn't require explicit hClose. Sorry, looks like I accidently hit r instead of L so it got taken off the mailing list. [0] http://book.realworldhaskell.org/read/io.html Look at that--the guts of the program take up only two lines! readFile returned a lazy String, which we stored in inpStr. We then took that, processed it, and passed it to writeFile for writing. 5 comments