> On Fri, Mar 10, 2000 at 01:42:01AM -0800, Simon Marlow wrote:
> > [...]
> > >   hPutBufBA  :: Handle -> ByteArray Int -> Int -> IO ()
> 
> > >   hPutBuf    :: Handle -> Addr -> Int -> IO ()
> > [...]
> 
> Why are the output functions of return type IO () and not also
> IO Int (or rather IO [some integral type large enough to 
> cover C's size_t])?
> There *is* possibility for partial writes on POSIX at least.

The idea is that the functions never return until the whole buffer is
written.  If the reading end (of a socket or pipe) is closed prematurely,
we'll get an IO error.

For reading, we return a partial read for end-of-file.  Partial reads due to
blocking are handled internally by the combinators.

Cheers,
        Simon

Reply via email to