[Haskell-cafe] Fun with the ST monad
quick at sparq.org
Fri Feb 25 17:25:30 CET 2011
On Thu, 24 Feb 2011 13:45:59 -0700, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
> The input list is being read from disk by lazy I/O. With the original implementation, the input file gets read at the same time as the output file is written. But runST returns nothing until the *entire* input has been compressed. So writing to disk doesn't start until the entire file has been slurped up into memory.
>Anybody have any hints on how to get around this?
I'd recommend using an enumerator/iterator package to read and process the file as a stream of chunks. The assumption here is that you don't need the entire input to provide enough state to begin generating output.
More information about the Haskell-Cafe