System.Posix.IO.ByteString fdRead and fdWrite.

Simon Marlow marlowsd at gmail.com
Thu Nov 21 10:55:36 UTC 2013


On 21/11/13 08:18, Herbert Valerio Riedel wrote:
> On 2013-11-21 at 00:03:46 +0100, Ashley Yakeley wrote:
>> In unix-2.7.0.0, fdRead and fdWrite in System.Posix.IO.ByteString use
>> String instead of ByteString. This is wrong, isn't it? The point of
>> the .ByteString modules is to do IO in ByteString.
>
> Fwiw, here's the commit introducing the ByteString API and stating its intention:
>
>    http://git.haskell.org/packages/unix.git/commitdiff/34c7bf896f19b182cf6fa104e057f1df9df1254a
>
> However, I'm not totally sure from that, whether the type-sigs
>
>
>   fdRead :: Fd
>          -> ByteCount -- ^How many bytes to read
>          -> IO (String, ByteCount) -- ^ The bytes read, how many bytes were read.
>
>   fdWrite :: Fd -> String -> IO ByteCount
>
>
> were really intended to be that way.
>
> Simon, maybe you can provide some insight here?

Brandon's reply is correct, the ByteString variant of the POSIX API is 
intended to change the representation of file paths only.

These two functions are totally useless and we need better versions anyway.

Cheers,
Simon



More information about the Libraries mailing list