[Haskell-cafe] Re: Lazy IO.

Achim Schneider barsoap at web.de
Mon Jun 16 12:31:48 EDT 2008

Jules Bean <jules at jellybean.co.uk> wrote:

> Sebastiaan Visser wrote:
> > On Jun 16, 2008, at 2:58 PM, Jules Bean wrote:
> > 
> >> Sebastiaan Visser wrote:
> >>> Does anyone know a pattern in which I can do this easily?
> >>
> >> Don't use hGetContents on a socket. That's asking for trouble.
> > 
> > Can you please explain why?
> Because it's a broken abstraction.
> It's only correct if all you will ever do is read all the data into
> one String and don't care about it after that.
> In my experience this is almost never true of sockets : there is
> always protocol overhead, handshaking, and the "next request".
It works for HTTP, as all responses MUST be in the same order as the

(c) this sig last receiving data processing entity. Inspect headers for
past copyright information. All rights reserved. Unauthorised copying,
hiring, renting, public performance and/or broadcasting of this
signature prohibited. 

More information about the Haskell-Cafe mailing list