[Haskell-cafe] readFile and closing a file
lemming at henning-thielemann.de
Wed Sep 17 07:31:26 EDT 2008
Say I acquire a text by readFile, feed it to a lazy parser and the parser
stops reading because of a parse error. After the parser error I won't
fetch more characters from the text file, but readFile does not get to
know that and cannot close the file. Actually, when encountering a parser
error I could read the remaining characters from the file in order to let
readFile close the file eventually, but this sounds rather inefficient.
So, what is the right way to go, or do I have to stay away from readFile
(and maybe unsafeInterleaveIO at all)?
More information about the Haskell-Cafe