RE: Text I/O library proposal, first draft

Hi Ben,
Bad things:
* There's no way to implement fgetpos/fsetpos type functionality, because coders don't expose their internal state. (In fact, there would need to be a way to explicitly copy the state, since it may well include IORefs, Ptrs, etc.) Is this a serious problem?
Yes! This is an enormously serious problem. At least for me. It's not a problem for writing files, but I really really really need this functionality when reading files. Reason: I'm often tooling around in very large (1gb or greater) files which happen to be sorted on some sort of index and I need to do binary search in them. To load all the file into Haskell or to do linear search is impossible. Other than that, I rather like the design. - Hal

On Thu, 31 Jul 2003, Hal Daume wrote:
Ben Rudiak-Gould wrote:
* There's no way to implement fgetpos/fsetpos type functionality, because coders don't expose their internal state. (In fact, there would need to be a way to explicitly copy the state, since it may well include IORefs, Ptrs, etc.) Is this a serious problem?
Yes! This is an enormously serious problem. At least for me.
It's not a problem for writing files, but I really really really need this functionality when reading files. Reason: I'm often tooling around in very large (1gb or greater) files which happen to be sorted on some sort of index and I need to do binary search in them. To load all the file into Haskell or to do linear search is impossible.
Keep in mind that this design lets you create arbitrarily many text-reading streams on top of a single open file, starting at any byte offset in the file. The only thing you can't do is read some text from a stream and then ask "where am I now?". Is that sufficient for what you need to do? (I'm a little unclear on the format of the files you're talking about.) -- Ben

presumably if you are doing random access on the file, it is in a known nonarbitrary text encoding (like utf8). in which case you can read/access the file with the binary routines and just use the appropriate text conversions to get data out. John On Thu, Jul 31, 2003 at 03:55:44PM -0700, Hal Daume wrote:
Hi Ben,
Bad things:
* There's no way to implement fgetpos/fsetpos type functionality, because coders don't expose their internal state. (In fact, there would need to be a way to explicitly copy the state, since it may well include IORefs, Ptrs, etc.) Is this a serious problem?
Yes! This is an enormously serious problem. At least for me.
It's not a problem for writing files, but I really really really need this functionality when reading files. Reason: I'm often tooling around in very large (1gb or greater) files which happen to be sorted on some sort of index and I need to do binary search in them. To load all the file into Haskell or to do linear search is impossible.
Other than that, I rather like the design.
- Hal -- Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
-- --------------------------------------------------------------------------- John Meacham - California Institute of Technology, Alum. - john@foo.net ---------------------------------------------------------------------------
participants (3)
-
Ben Rudiak-Gould
-
Hal Daume
-
John Meacham