FW: showing Handle is impure

Dean Herington heringto@cs.unc.edu
Mon, 21 Jul 2003 13:56:59 -0400


> > I've changed GHC's implementation so that it now displays just the
> > filename from the Handle (this is the the only immutable part of the
> > Handle).

I share Alastair's concern about the possibility that a handle may not always
contain a filename.  I think it would be cleaner to assume that the only immutable
part of a handle is its identity.  And it is important that the identity be shown
(that is, as by `show`).

I think we should we specify that `show`ing a `Handle` gives:
    "Handle " ++ handleId
or
    "(Handle " ++ handleId ++ ")"
depending in the usual way on the current precedence, and where `handleId` is
implementation-defined but required to identify the handle uniquely within the
current process.

>  This raises another question though: should there be an IO
> > operation for displaying the more interesting parts of a Handle?  I
> > propose:
> >
> >   System.IO.hShow :: Handle -> IO String
>
> Sounds good.

I agree.  I am content to leave the form of output implementation-defined.

-- Dean