[Haskell-cafe] Lazy IO.

Sebastiaan Visser sfvisser at cs.uu.nl
Mon Jun 16 09:11:03 EDT 2008


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?

What is a more easier method to spool your HTTP post data to a file  
than:

   Bs.hGetContens sock >>= Bs.hPut fd

?

> Use hGetContents either NEVER (easy option) or only on throwaway  
> handles/files which won't be used again.

My sockets will be thrown away eventually. Isn't anything? I can  
imagine that this can be a problem when using Keep-Alive connections  
- or alike - but that is a whole different story.

> Jules

Thanks,
Sebas.


More information about the Haskell-Cafe mailing list