[Haskell-beginners] Still wrestling with lazy IO

Sean Perry shaleh at speakeasy.net
Sun Jun 19 17:56:53 CEST 2011


Yes, close the socket (-:

On Jun 19, 2011, at 7:53 AM, Raphael Päbst wrote:

> I think, you're right. I read the ByteString from the handle using
> hGetContents, which then waits for eof, which I don't send apparently.
> Is there a way to do this explicitely?
> 
> Raf
> 
> On 6/19/11, Chaddaï Fouché <chaddai.fouche at gmail.com> wrote:
>> On Sat, Jun 18, 2011 at 10:26 PM, Raphael Päbst
>> <raphael.paebst at googlemail.com> wrote:
>>> Mainly I'd say it's that I want to send the answer back via the same
>>> handle. That's where the problem comes from, I suspect. Since it is
>>> lazy IO, it only evaluates, once the handle gets closed from the
>>> client side. And then it is too late to send something back. At least
>>> that's how I understand it.
>>> 
>> 
>> No it don't work like that, what's more probably happening is that
>> your program is structured so that the answer can't be created until
>> the "end" of the "request" is read and this "end" won't appear until
>> eof has been received. You should make it explicit in your request
>> that it is finished (send two empy lines at the end of the request for
>> instance). If you don't manage to do that, show us your code so that
>> we could point out your mistake.
>> 
>> --
>> JedaÏ
>> 
> 
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners




More information about the Beginners mailing list