annotateIO is added to base-4.20 published with ghc-9.10:
-- | Execute an 'IO' action, adding the given 'ExceptionContext'
-- to any thrown synchronous exceptions.
--
-- @since base-2.20.0.0
annotateIO :: forall e a. ExceptionAnnotation e => e -> IO a -> IO a
annotateIO ann (IO io) = IO (catch# io handler)
where
handler se = raiseIO# (addExceptionContext ann se)
annotateIO
is added tobase-4.20
published withghc-9.10
:This should be added to
MonadThrow
.