
On 3/5/11 10:03 AM, Bas van Dijk wrote:
On 5 March 2011 13:30, wren ng thornton
wrote: This currently consists of: * System.Posix.IO.ByteString * fdRead -- like System.Posix.IO.fdRead, the same as before.
What about changing this:
fdRead :: Fd -> ByteCount -> IO (ByteString, ByteCount)
to this:
fdRead :: Fd -> ByteCount -> IO ByteString
I agree that it's nice to be consistent with the String version but since that version might go away and since the length (O(1)) of the ByteString should always equal the ByteCount I think it's better to remove that invariant.
I even have a note in the source file to that effect :) One thing I considered was to offer both versions, one for compatibility with the old string versions (and for decluttering client code)[1] and then one that just gives the bytestring. Of course, then the issue is what to name them... So the big question is: how minimal should we be, vs how much in the way of convenience functions should we offer? Update: In v0.2.1 I added an fdReads function which lets you pass a predicate for determining whether to retry after incomplete reads. -- Live well, ~wren