[clean-list] UNIX (or POSIX) I/O

Donn Cave donn@u.washington.edu
Wed, 19 May 2004 17:27:07 -0700


I downloaded Clean yesterday and wrote my first program today.
It doesn't work, and from what I read in the archives of this
list, perhaps it can't.  I'm on MacOS X, but I assume it would
be the same for any other UNIX platform.

I wanted to try a program I'd previously written in Haskell,
that got into serious trouble with 300 Mb text input.  But to
start with I simply read in a line, from stdin.

When input is empty, I get "Heap full".  If I add a check for
end of file, I get an IO error stating that "fend" is not allowed
for stdio and stderr.  I understand from the archives that this
may be by design, in a manner of speaking.  So I or anyone who
would want to write a normal UNIX application will need some
alternative to StdFile.

I don't see any POSIX functions at all, so my question(s) -

- How hard would it be to "wrap" these functions?  open, read
   write, close, lseek, pipe, dup, dup2, ...   Is there a reasonably
   documented foreign function interface, including whatever is
   needed for I/O functions?

- Then I would want to add the buffered I/O functionality in
   a Clean module, which I'm going to assume would be feasible.
   So that's not a question, unless anyone feels differently.

Thanks,

	Donn Cave, donn@u.washington.edu