[GHC] #12096: Attach stacktrace information to SomeException
GHC
ghc-devs at haskell.org
Tue Mar 7 15:40:43 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: Exceptions
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 ndtimofeev):
We can substitute `?callStack` in `catch` from actual value to value from
caught exception value.
{{{#!hs
catch' :: Exception e => IO a -> (HasCallStack => e -> IO a) -> IO a
catch' eval handler = eval `catch` \err@(SomeExceptionWithStack stack _)
->
let ?callStack = stack in
case fromException err of
Just ex -> handler ex
_ -> throw err
}}}
Now all `throw` called from `catch` handler will be implicit rethrow. It
looks like a ugly hack and required Rank2Types.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12096#comment:18>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list