>>>>> "Malcolm" == Malcolm Wallace <[EMAIL PROTECTED]> writes:
Malcolm> In fact, Binary allows you to process the data directly
Malcolm> from the disk rather than hauling it all into memory.
Malcolm> This eliminates start-up time altogether. What's more,
Malcolm> provided the file is used read-only, you can use pure
Malcolm> lazy functions to read the data, rather than having to
Malcolm> sequence everything through the IO monad.
Is the fact that the processing is "directly from disk" transparent to
the programmer or does the processing function have to be written
differently to avoid startup time ? Does 'get' return its result
lazily ?
I've been looking at the html doc and the nhc Binary src, but I can't
quite see a transparent way of processing data on disk. There is the
putAt operation, but that needs a file pointer; and there is the
BinArray, which can only be written sequentially.
If one were to read a (large) data structure, modify it slightly
(in-place), then write back the change (without using a file pointer),
I imagine the whole data structure would be written back to
disk. Whereas using a memory mapped file, only modified pages would be
written back.
Would it be helpful and possible to bolt a mmap'ed file underneath
some of these operations so that large data structures could be
modified (either functionally or in-place) without having to write
back the whole structure ? I guess the problem comes back to lazy
closures and associated pointers to volatile code.
Tim
--
----------------------------------------------------------------------
T.R.BARBOUR Email : [EMAIL PROTECTED]
----------------------------------------------------------------------
Department of Computer Science
The University of Melbourne
Parkville, Victoria 3052
Australia
----------------------------------------------------------------------