[Haskell-cafe] Re: [Haskell] Re: ANNOUNCE: enumerator, an alternative iteratee package

Simon Marlow marlowsd at gmail.com
Mon Aug 23 08:00:04 EDT 2010


On 23/08/2010 12:57, Felipe Lessa wrote:
> On Mon, Aug 23, 2010 at 8:51 AM, Simon Marlow<marlowsd at gmail.com>  wrote:
>> Hmm, RawIO.read looks ok:
>>
>> -- | Read up to the specified number of bytes, returning the number
>> -- of bytes actually read.  This function should only block if there
>> -- is no data available.  If there is not enough data available,
>> -- then the function should just return the available data. A return
>> -- value of zero indicates that the end of the data stream (e.g. end
>> -- of file) has been reached.
>>
>> that seems pretty clear to me.  No?
>
> It says that it "should only block if there is no data available".  I
> assumed that fillReadBuffer has the same semantics.  If both do not
> block if there is data, then hGetBuf would not wait for the buffer to
> be filled, if I am reading its source correctly [1].  Either they do
> block until the buffer is filled, or I'm misreading hGetBuf/bufRead.
> =)

I think it's the latter.  bufRead loops until it has read the full 
amount of data requested, or EOF is reached.

Cheers,
	Simon


> [1] http://www.haskell.org/ghc/docs/6.12.2/html/libraries/base-4.2.0.1/src/GHC-IO-Handle-Text.html#line-820
>
> Cheers! =)
>



More information about the Haskell-Cafe mailing list