Proposal: add System.Posix.fdReadBuf/fdWriteBuf
dons at galois.com
Tue May 12 13:06:54 EDT 2009
> From the ticket:
> Functions for reading/writing actual arrays of bytes in memory. At the
> moment, `System.Posix` only provides
> fdRead :: Fd
> -> ByteCount -- ^How many bytes to read
> -> IO (String, ByteCount) -- ^The bytes read, how many bytes were
> fdWrite :: Fd -> String -> IO ByteCount
> which are not only wrong (`String`?), but too slow for many purposes.
> I propose
> Mon May 11 16:21:02 BST 2009 Simon Marlow <marlowsd at gmail.com>
> * add fdReadBuf, fdWriteBuf
> -- | Read data from an 'Fd' into memory. This is exactly equivalent
> -- to the POSIX @read@ function.
> fdReadBuf :: Fd
> -> Ptr Word8 -- ^ Memory in which to put the data
> -> ByteCount -- ^ Maximum number of bytes to read
> -> IO Bytecount -- ^ Number of bytes read (zero for EOF)
> -- | Write data from memory to an 'Fd'. This is exactly equivalent
> -- to the POSIX @write@ function.
> fdWriteBuf :: Fd
> -> Ptr Word8 -- ^ Memory containing the data to write
> -> ByteCount -- ^ Maximum number of bytes to write
> -> IO ByteCount -- ^ Number of bytes written
> darcs patches are attached to the ticket.
> Discussion: 2 weeks (ends 25 May)
Rocking. Go for it.
More information about the Libraries