[GHC] #16048: Show Instance for IOException discards error code

#16048: Show Instance for IOException discards error code -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- 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. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16048 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16048: Show Instance for IOException discards error code -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * keywords: => newcomer Comment: The error code sounds to me like a reasonable thing to include. Patches welcome! -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16048#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16048: Show Instance for IOException discards error code -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by andrewthad): PR on github at https://github.com/ghc/ghc/pull/241 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16048#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16048: Show Instance for IOException discards error code -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by ulysses4ever): * status: new => patch -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16048#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#16048: Show Instance for IOException discards error code -------------------------------------+------------------------------------- Reporter: andrewthad | Owner: (none) Type: bug | Status: patch Priority: normal | Milestone: Component: Compiler | Version: 8.6.3 Resolution: | Keywords: newcomer Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by makos): I can provide example outputs based on compiled ghc (old/new): Original behaviour: {{{ System.Directory.renameFile "a.a" "" *** Exception: a.a: renameFile:renamePath:rename: does not exist (No such file or directory) }}} Updated behaviour: {{{ System.Directory.renameFile "a.a" "" *** Exception: a.a: renameFile:renamePath:rename: does not exist (2) (No such file or directory) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/16048#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC