unix-bytestring v0.2.0 (Was: Re: Proposal: add ByteString support to unix:System.Posix.IO API)
wren ng thornton
wren at freegeek.org
Sat Mar 5 13:30:24 CET 2011
When I wrote the original bytestring-unix v0.1.0 I tried to stick as
close as possible to the System.Posix.IO interface. However, it seems
that folks aren't too fond of that interface. So, for your consideration
unix-bytestring v0.2.0 (note the name change)
This currently consists of:
* fdRead -- like System.Posix.IO.fdRead, the same as before.
* fdWrite -- like System.Posix.IO.fdWriteBuf, the same as before.
* fdWrites -- like the previous lazy bytestring implementation. It
performs a write(2) call for each chunk, but it supports lazy streaming.
* fdWritev -- Convert a list of bytestrings into a C array of iovec
structs, and then perform a single writev(2) call.
-- I'm keeping this around for now, for my own convenience.
* fdRead -- simple wrapper around
System.Posix.IO.ByteString.fdRead, the same as before.
* fdWrites -- like System.Posix.IO.ByteString.Writes, and
essentially the same as before
* fdWritev -- simple wrapper around System.Posix.IO.ByteString.fdWritev
-- The data type representing a C struct iovec, plus some helper
functions for converting between bytestrings and iovecs.
I think the writev implementations are correct after some basic testing,
though I haven't used hsc2hs nor writev before, so there may be some odd
corner cases lurking in there. I'm not dead-set on the current API,
though I've tried to keep it minimal and maximally expressive. Play
around with it. Try to break it. Let me know what you'd still like to
P.S., what the heck is readv(2) supposed to be good for? Does anyone
want to see a binding for it?
P.P.S, does anyone want to see pread(2) or pwrite(2) bindings?
More information about the Libraries