Proposal for a new I/O library design

Sven Panne
Tue, 29 Jul 2003 20:26:10 +0200

I think this discussion is getting a little bit erratic. Before we discuss
solutions, let's state our problems clearly! It is not so obvious what
makes people unhappy with Haskell's current I/O libs, at least for me. OK,
there are some obvious design flaws (Char vs. Octet), but let's collect
the problematic areas first, then we can separately discuss solutions for
them. I'll start with a probably incomplete list of things I've read here
so far:

* There is no standard way of doing binary I/O, i.e. reading and writing
   bytes, only character I/O.

* Sometimes even bit I/O is wanted. (This could be layered upon byte I/O.)

* We want to encode/decode bytes into characters using a given encoding.

* There is no easy way to read/write data in a given format like IEEE floats,
   little-endian 32bit ints, ... (Could be done via byte I/O + FFI stuff, but
   not very comfortably)

* Persistent data structures are missing from the libs/language.

* Buffering issues, including support for mmap-like features.

* Mapping a name to a stream/channel/file/handle/... (a.k.a. "open" :-)

(to be continued by others, I hope)

Of course these topics are somehow interrelated, but I doubt that we can
solve them all at once. So let's complete this list and pick the most basic
topics first...