Binary IO

Peter Simons simons at
Fri Apr 22 07:04:58 EDT 2005

Simon Marlow writes:

 > Does anyone have any *objections* to introducing

 >   System.IO.hGetWord8 :: Handle -> IO Word8
 >   System.IO.hPutWord8 :: Word8 -> Handle -> IO Word8

I don't mind having these functions, but to be honest I
doubt that they would be useful for real life applications.
Reading a byte at a time is a performance nightmare,
buffering or not. IMHO, the much better API is this one:

  hPutBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int
  hGetBufNonBlocking :: Handle -> Ptr a -> Int -> IO Int


More information about the Libraries mailing list