Show Instance for IOException discards error code
The Show
instance for IOException
currently looks like this:
instance Show IOException where
showsPrec p (IOError hdl iot loc s _ fn) =
(case fn of
Nothing -> case hdl of
Nothing -> id
Just h -> showsPrec p h . showString ": "
Just name -> showString name . showString ": ") .
(case loc of
"" -> id
_ -> showString loc . showString ": ") .
showsPrec p iot .
(case s of
"" -> id
_ -> showString " (" . showString s . showString ")")
Notice that it discards the error code (the fifth field in the data constructor). This means that when we call ioError
to raise an IOException
, we end up missing out on useful information. For example, in a project I'm working on now, I get this:
*** Exception: Network.Icmp.Ping: ping: permission denied (Permission denied)
But I expected to see the original error code in there as well, which would help me diagnose issues.
Trac metadata
Trac field | Value |
---|---|
Version | 8.6.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Compiler |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |