The impl for this kind of stuff is already in there:
hFillBufBA :: Handle -> ByteArray Int -> Int -> IO Int
hPutBufBA :: Handle -> ByteArray Int -> Int -> IO ()
hFillBuf :: Handle -> Addr -> Int -> IO Int
hPutBuf :: Handle -> Addr -> Int -> IO ()
all available from PrelHandle.
--sigbjorn
> -----Original Message-----
> From: Simon Peyton-Jones [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, March 09, 2000 02:26
> To: Sven Panne; Johannes Waldmann
> Cc: [EMAIL PROTECTED]
> Subject: RE: binary IO
>
>
> | But Haskell *really* needs some standard way of reading
> values in the
> | native format on a platform:
>
> What about this specification?
>
> hReadByteArray :: Handle -> MutableByteArray a -> Int -> IO Int
> -- Read the specified number of *bytes* into the byte array.
> -- Return the number of bytes actually read.
> -- By treating the result as a MutableByteArray Float (say), you
> -- get binary I/O
>
> hWriteByteArray :: Handle -> MutableByteArray a -> Int -> IO ()
> -- Similarly for write (but no Int returned)
> -- The 'mutable' part isn't necessary for the write,
> but a client
> -- will typically write an Int (say) into it just
> before calling.
>
> Both may block.
>
> Would that do what you want? If so we can add it to IOExts.
>
> Simon
>
>
>