[GHC] #12096: Attach stacktrace information to SomeException

GHC ghc-devs at haskell.org
Sun Mar 5 10:15:35 UTC 2017


#12096: Attach stacktrace information to SomeException
-------------------------------------+-------------------------------------
        Reporter:  ndtimofeev        |                Owner:  (none)
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Core Libraries    |              Version:  8.0.1
      Resolution:                    |             Keywords:
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 mnislaih):

 I reached the same conclusion, we have to embed call stacks in every
 exception type. But I don't think this is incompatible with adding them at
 the SomeException level.

 We cannot touch SomeException without breaking all the existing Exception
 instances, so we introduce a new primitive ancestor
 SomeExceptionWithCallStack in the hierarchy:
 {{{
               SomeExceptionWithCallStack
                  ^                ^
                  |                |
                  |                |
         SomeException           IOError
 }}}

 {{{
 data SomeExceptionWithCallStack = SomeExceptionWithCallStack Exception
 [CallStack]
 data IOError = IOError { ... callStack : [CallStack], ...}

 class ExceptionWithCallStack e where
     toExceptionWithCallStack :: e -> SomeExceptionWithCallStack
     fromExceptionWithCallStack :: SomeExceptionWithCallStack -> Maybe e

 instance ExceptionWithCallStack SomeException ...
 instance ExceptionWithCallStack IOError ...
 }}}

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


More information about the ghc-tickets mailing list