[Haskell-cafe] Seeking comments on this IO proposal

John Goerzen jgoerzen at complete.org
Fri Dec 17 11:48:34 EST 2004

Thank you, Ben, Simon PJ, Simon M, David, and the others that sent such
helpful responses.

It seems that there is rough consensus that Ben/SimonM's ideas are the
right way forward.  Obviously these ideas represent a significant shift
from the way things are now.  I spent some time looking over Simon's
example.  My first reaction was: "this is almost as complex as Java."
Then I saw the System.IO.Text module, and how it could be used in a
pretty much self-contained fashion with the same ease as the current IO
system, and I felt much better about it.  I like the ideas.

There are two concerns, though, before I dive right into something like

First, if someone were to make a working, useful package out of this, is
it likely that it would become the "standard" (whatever that means) IO
system in Haskell anytime in the near future?  I ask because I don't
want to put a lot of time into developing an IO library, and code that
works with it, only to have nobody use my code because it's incompatible
with everything they're doing.

Second is my own level of expertise.  I frankly don't understand how
much of that code could even compile (example: I couldn't find
setNonBlockingFD anywhere in my docs; maybe it's from one of those GHC.*
areas), and I don't really understand the whole array/buffer situation
either.  I spent some time reading docs, and I'm still not sure exactly
how one builds a mutable, resiable array.  I've also never done anything
but the most trivial FFI work.

I'm willing to learn, but since there's a lot there that's new to me,
I'm not terribly confident that I would write correct, useful code.  I'm
especially unsure of how to make it work with the non-GHC
compilers/interpreters out there, given all the GHC pragmas in the code.

On Fri, Dec 17, 2004 at 12:09:34AM +0000, Ben Rudiak-Gould wrote:
> John Goerzen wrote:
> >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
> The proposal on Simon M's page was originally my design, though Simon 
> made many improvements. You can read my rationale for the original 
> design in these mailing-list messages:
>    http://www.haskell.org/pipermail/haskell/2003-July/012312.html
>    http://www.haskell.org/pipermail/libraries/2003-July/001255.html
>    http://www.haskell.org/pipermail/libraries/2003-July/001257.html
>    http://www.haskell.org/pipermail/libraries/2003-July/001273.html
>    http://www.haskell.org/pipermail/libraries/2003-August/001319.html
>    http://www.haskell.org/pipermail/libraries/2003-August/001336.html
>    http://www.haskell.org/pipermail/libraries/2003-August/001366.html
> I had to abandon many of the original ideas because the Posix and Win32 
> APIs can't support them. (Some examples of things you should be able to 
> do, but can't in Posix or Win32: given a directory handle and the name 
> of a file in the directory, open that file; given a file handle with 
> read access, acquire write access if available; conduct atomic 
> filesystem transactions.) The most important idea that survives is the 
> separation of files from input streams and output streams,
> Given this background you can probably guess that I'm not too keen on 
> the traditional open/read/write/seek/close model; I don't think it's a 
> good abstraction for anything, even files. I love the idea of gzip and 
> gunzip as transformations on streams, though, and streams backed by 
> memory buffers appear in my proposal too.
> > * Would I be better advised to try to implement some existing ideas
> >   instead?
> Yes, you should definitely spend your time implementing my pet idea, not 
> yours. :-)
> > * Are there any other implementations of these things that are ready
> >   to use?  (With code)
> Simon wrote a prototype implementation of his/my proposal:
>    http://www.mail-archive.com/haskell-cafe@haskell.org/msg05138.html
> -- Ben

More information about the Haskell-Cafe mailing list