[Haskell-cafe] Writing binary files?

Sven Panne Sven.Panne at aedion.de
Sun Sep 12 10:49:58 EDT 2004


Glynn Clements wrote:
> The problem with this approach is that the entire array has to be held
> in memory, which could be an issue if the amount of data involved is
> large.

Simple reasoning: If the amount of data is large, you don't want the overhead
of lists because it kills performance. If the amount of data is small, you
can easily use similar code to read/write a single byte. :-)

Of course things are a bit different when you are in the blissful position
where lazy I/O is what you want. This implies that you expect a stream of
data of a single type. How often is this really the case? And I'm not sure
if this the correct way of doing things even when the data involved wouldn't
fit into memory all at once. I'd prefer something mmap-like then...

Cheers,
    S.


More information about the Haskell-Cafe mailing list