haskell-cafe@haskell.org
[Top] [All Lists]

Re[2]: [Haskell-cafe] Trying to write a very simple HTTP Client

Subject: Re[2]: [Haskell-cafe] Trying to write a very simple HTTP Client
From: Bulat Ziganshin
Date: Fri, 23 May 2008 19:08:14 +0400
Hello Johan,

Friday, May 23, 2008, 5:58:04 PM, you wrote:

>>           cs    <- hGetLine out
>>           hClose out
>>           print cs
>>
> I think you need to either print cs before you close the socket or
> make sure that cs is force (~computed) before you close the socket as
> laziness makes it get evaluated when you call print cs rather than
> when you call hGetLine. In other words, you try to read from the
> socket after you've closed it.

hGetLine, unlike hGetContents, has a strict semantics. actually,
hGetContents is only lazy i/o operation, everything else (hGetChar,
hGetBuf, hGetArray) is strict


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin@xxxxxxxxx

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe

<Prev in Thread] Current Thread [Next in Thread>