I ran into this issue recently for some code that needed to both read and then later write to the same file. readFile didn't work as expected because it kept the file handle open. I could restructure the code so the entire logic was in inside a `withFile` block, but I preferred not to.
I wrote something similar to Zoran's original code and was stumped until I googled around. I want to share this stackoverflow answer regarding deepseq to force evaluation
http://stackoverflow.com/a/9423349 (the key takeaway being `return $!! res` for Zoran's code)
But really, the default built-in lazy I/O on standard lists are fine for general usage. Avoid premature optimization.
I agree with Kim here, so I'm not contradicting that sentiment. It's just nice to know the next step to take if the original lazy I/O code isn't working out.