Are handles closed automatically when they fall out of scope?

John Goerzen jgoerzen at
Sun Oct 24 18:36:41 EDT 2004

On 2004-10-22, Peter Simons <simons at> wrote:
> I know it's a rather mundane question, but I couldn't find
> an answer to it!
> So what does happen when I forget to hClose a Handle? Will
> the garbage collector do that for me? Or not?

I'd like the answer to this question, too, but also:

* Does the same hold true for sockets?

* For sockets that also exist as Handles?

* What happens when one Handle corresponding to a socket is closed, but
  another isn't?

* What happens when one gets GC'd but another doesn't?

> And while I am at it: How about Socket? Do I have to sClose
> a socket I obtained from listenOn or accept?

Ah.  I already asked some of this :-)

More information about the Glasgow-haskell-users mailing list