FW: showing Handle is impure
Simon Marlow
simonmar@microsoft.com
Tue, 22 Jul 2003 10:15:14 +0100
=20
> I'm a little surprised that there always is a filename though=20
> - I thought (but=20
> haven't bothered to check) that Handles were used for=20
> anything that can=20
> contain a file descriptor: files, pipes, network connections,=20
> etc. No big=20
> deal but what is the output in these cases? (The file=20
> descriptor number=20
> 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