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

John Millikin jmillikin at gmail.com
Fri Aug 20 18:12:41 EDT 2010


On Fri, Aug 20, 2010 at 14:58, Magnus Therning <magnus at therning.org> wrote:
> Indeed.
>
> In many protocols it would force the attacker to send well-formed requests
> though.  I think this is true for many text-based protocols like
> HTTP.
>
> The looping can be handled effectively through hWaitForInput.
>
> There are also other reasons for doing non-blocking IO, not least that it
> makes developing and manual testing a lot nicer.

I think I'm failing to understand something.

Using a non-blocking read doesn't change how the iteratees react to
well- or mal-formed requests. All it does is change the failure
condition from "blocked indefinitely" to "looping indefinitely".

Replacing the hGet with a combination of hWaitForInput /
hGetNonBlocking would cause a third failure condition, "looping
indefinitely with periodic blocks". This doesn't seem to be an
improvement over simply blocking.

Do you have any example code which works well using a non-blocking
enumerator, but fails with a blocking one?


More information about the Haskell-Cafe mailing list