
On 23/08/2010 12:10, Felipe Lessa wrote:
Hello, Simon!
On Mon, Aug 23, 2010 at 8:00 AM, Simon Marlow
wrote: The issue is that hGet always waits for a complete buffer-full of data before returning. The hWaitForInput/hGetNonBlocking combination fixes that problem, but you have to be careful to make sure that the Handle is in binary mode, otherwise hWaitForInput will not behave the way you expect (it will decode the input byte stream, and wait for a full character). For more information, see
http://hackage.haskell.org/trac/ghc/ticket/3808
A better fix is to use hGetBufSome, but (a) it is only available in GHC 6.14 which isn't released yet, and (b) there isn't a bytestring wrapper for it yet.
So there really is a problem in the documentation of hGetBuf. I assume it got fixed in HEAD together with hGetBufSome.
Which documentation are you referring to? This looks ok to me: http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/System-IO... Cheers, Simon