Hi Yitz,
I tried "evaluate" before posting my question, and for some reason it didn't
change the behavior. But strict bytestrings worked. I haven't tried Text yet.
It was a pain putting "map (chr . fromIntegral)" in front of everything to get
regular strings.

On Wed, Nov 9, 2011 at 10:40 AM, Yitzchak Gale <gale@sefer.org> wrote:

To solve the problem when using readFile from the
Prelude, you would need to make sure that each
file is read all the way to the end as you go along.
One trick sometimes used for that is to use the
evaluate function from Control.Exception to force
evaluation of the length of each file:

 b <- readFile s
 evaluate $ length b
 ...

That would cause the entire contents of the file
to be read into memory immediately and the
file to be closed, like the behavior of readFile
for strict ByteString and strict Text.

-Yitz