
I'm a little surprised that there always is a filename though - I thought (but haven't bothered to check) that Handles were used for anything that can contain a file descriptor: files, pipes, network connections, etc. No big deal but what is the output in these cases? (The file descriptor number suggests itself - immutable though not necessarily unique.)
And one other point I just remembered: if we allow hDuplicateTo: hDuplicateTo :: Handle -> Handle -> IO () (which is currently available from GHC.Handle), then there is very little that is immutable in the Handle. In fact, even the "handle description" I talked about before is not really immutable, but it doesn't do much harm to consider it immutable. For example, if I say h <- openFile "/dev/null" hDuplicateTo h stdout print stdout should I get "/dev/null" or "<stdout>"? (currently GHC will say "<stdout>", because I'm treating the handle description as immutable). Cheers, Simon
participants (1)
-
Simon Marlow