[GHC] #5902: Cannot tell from an exception handler whether the exception was asynchronous

GHC ghc-devs at haskell.org
Wed Aug 14 00:49:44 CEST 2013


#5902: Cannot tell from an exception handler whether the exception was
asynchronous
-------------------------------------+------------------------------------
        Reporter:  simonmar          |            Owner:  simonmar
            Type:  bug               |           Status:  new
        Priority:  high              |        Milestone:  7.8.1
       Component:  Compiler          |          Version:  7.4.1
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by exbb2):

 Replying to [comment:21 simonmar]:
 > Just never catch `SomeException` unless you intend to re-throw it.

 The code in my case quickly grew into monstrosity such as
 {{{
 bracket openFile doDangerousStuff close
  `catches`
   [\Async -> throw
   ,\Some  -> logFailureAndResume]
 }}}
 Even that doesn't work for Timeout, unless we resort to string comparison.

 > If you're handling an exception, you always know which exception(s)
 you're handling

 No. All arguments and values in function can throw any exception
 whatsoever, there can be no knowing of what exceptions you'll receive.
 e.g. what if the next version of base introduces a hard-to-track division
 by zero?

 We shouldn't ever care about what exception we got. If it had arisen from
 code enclosed by the handler, — there can be no doubt as to its intended
 recipient — and no danger in catching it.
 Asynchronous exceptions have only dimmest relation to code being executed
 or none at all, there can be no modularity when every exception handler is
 concerned with whole state of the universe.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5902#comment:22>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler




More information about the ghc-tickets mailing list