Thanks! I was worried about how/where would I place hClose!
On Mon, Apr 14, 2008 at 10:58 PM, Brent Yorgey [EMAIL PROTECTED] wrote:
2008/4/14 Abhay Parvate [EMAIL PROTECTED]:
Hello,
In describing the Handle type, the GHC documentation says (in the
System.IO documentation):
GHC
I usually use something like this instead:
hStrictGetContents :: Handle - IO String
hStrictGetContents h = do
s - hGetContents h
length s `seq` hClose h
return s
This guarantees the following:
1) The whole file is read before hStrictGetContents exits (could be
considered bad, but
Thanks Ryan, this will definitely not leak handles. I had thought about
making a strict version of hGetContents, though on a bit different lines.
My question was that since the documentation says that the semi-closed
handle becomes closed as soon as the entire contents have been read; can I
2008/4/14 Abhay Parvate [EMAIL PROTECTED]:
Hello,
In describing the Handle type, the GHC documentation says (in the
System.IO documentation):
GHC note: a Handle will be automatically closed when the garbage collector
detects that it has become unreferenced by the program. However, relying