You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The catchSTM combinator exposed by GHC.Conc, GHC.Conc.Sync, and the stm package currently does not attach WhileHandling annotations to exceptions thrown from its handler, as described in #202. This functionality was requested in GHC #25365.
I propose that we introduce an annotateSTM combinator to GHC.Conc and GHC.Conc.Sync:
+-- | Execute an 'STM' action, adding the given 'ExceptionContext'+-- to any thrown synchronous exceptions.+annotateSTM :: forall e a. ExceptionAnnotation e => e -> STM a -> STM a+annotateSTM ann (STM io) = STM (catch# io handler)+ where+ handler se = raiseIO# (addExceptionContext ann se)
and use it from catchSTM:
catchSTM (STM m) handler = STM $ catchSTM# m handler'
where
handler' e = case fromException e of
- Just e' -> unSTM (handler e')+ Just e' -> unSTM (annotateSTM (WhileHandling e) (handler e'))
Nothing -> raiseIO# e
The
catchSTM
combinator exposed byGHC.Conc
,GHC.Conc.Sync
, and thestm
package currently does not attachWhileHandling
annotations to exceptions thrown from its handler, as described in #202. This functionality was requested in GHC #25365.I propose that we introduce an
annotateSTM
combinator toGHC.Conc
andGHC.Conc.Sync
:and use it from
catchSTM
:Implemented in GHC !13408.
The text was updated successfully, but these errors were encountered: