From 5c1eb81f8b3890e142740f6cb36ff8a4ca26de44 Mon Sep 17 00:00:00 2001 From: Jens Nolte <git@queezle.net> Date: Sun, 29 Aug 2021 23:31:44 +0200 Subject: [PATCH] Add async_ and asyncWithUnmask_ Co-authored-by: Jan Beinke <git@janbeinke.com> --- src/Quasar/Async.hs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Quasar/Async.hs b/src/Quasar/Async.hs index 457828b..06c196b 100644 --- a/src/Quasar/Async.hs +++ b/src/Quasar/Async.hs @@ -1,6 +1,8 @@ module Quasar.Async ( -- * Async/await MonadAsync(..), + async_, + asyncWithUnmask_, -- * Task Task, @@ -80,6 +82,14 @@ liftUnmask unmask action = do liftIO $ unmask $ runReaderT action value +async_ :: MonadAsync m => m () -> m () +async_ = void . async + +asyncWithUnmask_ :: MonadAsync m => ((forall a. m a -> m a) -> m ()) -> m () +asyncWithUnmask_ action = void $ asyncWithUnmask action + + + -- | A task that is running asynchronously. It has a result and can fail. -- The result (or exception) can be aquired by using the `IsAwaitable` class (e.g. by calling `await` or `awaitIO`). -- GitLab