[GHC] #12096: Attach stacktrace information to SomeException

GHC ghc-devs at haskell.org
Sat May 21 14:21:13 UTC 2016


#12096: Attach stacktrace information to SomeException
-------------------------------------+-------------------------------------
           Reporter:  ndtimofeev     |             Owner:
               Type:  feature        |            Status:  new
  request                            |
           Priority:  normal         |         Milestone:
          Component:                 |           Version:  8.0.1
  libraries/base                     |
           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:
-------------------------------------+-------------------------------------
 Now (base 4.9.0.0) ErrorCall contain field for stacktrace information and
 error fills it.

 If you add field for stacktrace information to SomeException

 {{{#!hs
 data SomeException where
     SomeExceptionWithLocation :: Exception e => String -> e ->
 SomeException

 pattern SomeException :: () => Exception e => e -> SomeException
 pattern SomeException err <- SomeExceptionWithLocation _ err where
   SomeException err = SomeExceptionWithLocation "" err

 }}}

 and will fills it in throw

 {{{#!hs
 throw :: (HasCallStack, Exception e) => e -> a
 throw e = unsafeDupablePerformIO $ do
     stack <- currentCallStack
     raise# (CallStackException e $ if stack /= []
         then prettyCallStack ?callStack ++ "\n" ++ renderStack stack
         else prettyCallStack ?callStack)
 }}}

 it will be more useful for ghci users.

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


More information about the ghc-tickets mailing list