[Haskell-cafe] Seeking comments on this IO proposal

John Goerzen jgoerzen at complete.org
Thu Dec 16 14:54:01 EST 2004


Hello,

One of my favorite features from Python is its notion of "file-like
objects".  For those of you unfamiliar with Python, here's a quick
backgrounder:  anything can present a file-like interface.  It could be
a file, socket, an interface to a gzip/gunzip processor, character set
codecs, in-memory buffers, etc.  File-like objects are used in Python
for everything from gzip files to certain network data.  The memory
buffers are great for unit testing.

As I've started working on some gzip stuff in Haskell, I've developed a
prototype for a similar concept in Haskell.  One of my main goals is to
keep is as compatible with standard Haskell as I possibly can.  To that
end, a Handle is still acceptable as a parameter to any of the functions
I'm proposing.

My proposal is here:

  http://www.complete.org/~jgoerzen/t/MissingH.IO.HVIO.html

I'm aware that others have been working on IO proposals; specifically,
Simon Marlow's here:

  http://www.haskell.org/~simonmar/io/System.IO.html

I'm especially interested in their feedback on my proposal, and I'm
wondering:

 * Do you think HVIO has merit?

 * Would I be better advised to try to implement some existing ideas
   instead?

 * Are there any other implementations of these things that are ready
   to use?  (With code)

One note: I'm trying to keep the interface and behavior as identical to
the normal System.IO interface as possible.  So I'm still using Strings,
raising the same exceptions, etc.  In fact, the Handle instance of these
classes looks like:

instance Handle HVIOReader
   vGetChar = hGetChar
   ...

-- John




More information about the Haskell-Cafe mailing list