[project @ 2003-07-21 16:50:20 by simonmar]
authorsimonmar <unknown>
Mon, 21 Jul 2003 16:50:21 +0000 (16:50 +0000)
committersimonmar <unknown>
Mon, 21 Jul 2003 16:50:21 +0000 (16:50 +0000)
commit0c5850d96fccf621aa3bcbc15135020bd54533c5
tree3ac86b542daba9c8379c9cdf477c33548225ca8c
parent1955bdfdcd21560fe51e97614b3775c33c858f96
[project @ 2003-07-21 16:50:20 by simonmar]
GHC's instance Show Handle is wrong, because it is impure.  This
commit makes the Show instance pure by restricting what it shows to
just the filename.

I moved the filename from the Handle__ (the mutable portion of the
Handle) to the Handle proper, to facilitate this.  This might result
in a small performance improvment because Handle__ is now slightly
smaller.

Also added:

  GHC.Handle.hShow :: Handle -> IO String

which provides the old functionality, but now in the IO monad.
Pending discussion on the libraries list, this may be exposed by
System.IO.

Also, while I was here, I did something I've been meaning to do for a
long time: change the godawful IOError Show instance.

Previously:

   illegal operation
   Action: hGetChar
   Handle: {loc=<stdin>,type=semi-closed,binary=False,buffering=block (8192)}
   Reason: handle is closed
   File: <stdin>

Now:

   <stdin>: hGetChar: illegal operation (handle is closed)

This is going to result in a bunch of test failures, but I'll deal
with those later.
GHC/Handle.hs
GHC/IOBase.lhs