Skip to content
Snippets Groups Projects
Commit f4a8f2a7 authored by Jens Nolte's avatar Jens Nolte
Browse files

Export awaitSTM

parent 26fe5082
No related branches found
No related tags found
No related merge requests found
Pipeline #2612 passed
......@@ -2,6 +2,7 @@ module Quasar.Awaitable (
-- * MonadAwaitable
MonadAwait(..),
peekAwaitable,
awaitSTM,
-- * Awaitable
IsAwaitable(toAwaitable),
......@@ -76,6 +77,8 @@ instance MonadAwait IO where
`catch`
\BlockedIndefinitelyOnSTM -> throwM BlockedIndefinitelyOnAwait
-- | `awaitSTM` exists as an explicit alternative to an `Awaitable STM`-instance, to prevent code which creates- and
-- then awaits resources without knowing it's running in STM (which would block indefinitely when run in STM).
awaitSTM :: Awaitable a -> STM a
awaitSTM (toAwaitable -> Awaitable x) =
x `catch` \BlockedIndefinitelyOnSTM -> throwM BlockedIndefinitelyOnAwait
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment