Are handles closed automatically when they fall out of scope?

Peter Simons simons at cryp.to
Mon Oct 25 16:07:59 EDT 2004


John Goerzen writes:

 > Now, if [I read with hGetContents h], then the first read
 > I try to make using it works, but subsequent ones don't,
 > since the first one made it half-closed already.

Maybe I misunderstood something ... but why do you need to
read from the stream multiple times after calling
hGetContents? The function returns the _entire_ (lazily
evaluated) input stream, there is no need to read again. You
already _have_ everything.

Peter



More information about the Glasgow-haskell-users mailing list