[Haskell-cafe] Trying to write a very simple HTTP Client
Bulat Ziganshin
bulat.ziganshin at gmail.com
Fri May 23 11:08:14 EDT 2008
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 at gmail.com
More information about the Haskell-Cafe
mailing list