diff --git a/ki/src/Ki/Internal/IO.hs b/ki/src/Ki/Internal/IO.hs index 02d0710..3a3688f 100644 --- a/ki/src/Ki/Internal/IO.hs +++ b/ki/src/Ki/Internal/IO.hs @@ -79,7 +79,7 @@ uninterruptiblyMasked (IO io) = IO (maskUninterruptible# io) -- Like try, but with continuations -tryEitherSTM :: Exception e => (e -> STM b) -> (a -> STM b) -> STM a -> STM b +tryEitherSTM :: (Exception e) => (e -> STM b) -> (a -> STM b) -> STM a -> STM b tryEitherSTM onFailure onSuccess action = join (catchSTM (onSuccess <$> action) (pure . onFailure)) diff --git a/ki/src/Ki/Internal/Scope.hs b/ki/src/Ki/Internal/Scope.hs index 42e139c..2dccd5f 100644 --- a/ki/src/Ki/Internal/Scope.hs +++ b/ki/src/Ki/Internal/Scope.hs @@ -25,11 +25,12 @@ import Control.Exception uninterruptibleMask, pattern ErrorCall, ) -import Control.Monad (when, guard) +import Control.Monad (guard, when) import Data.Foldable (for_) import Data.Functor (void) import Data.IntMap (IntMap) import qualified Data.IntMap.Lazy as IntMap.Lazy +import Data.Maybe (isJust) import Data.Void (Void, absurd) import GHC.Conc ( STM, @@ -58,7 +59,6 @@ import Ki.Internal.IO uninterruptiblyMasked, ) import Ki.Internal.Thread -import Data.Maybe (isJust) -- | A scope. -- @@ -360,7 +360,7 @@ forkWith_ scope opts action = do -- -- * Synchronous (/i.e./ not an instance of 'SomeAsyncException'). -- * An instance of @e@. -forkTry :: forall e a. Exception e => Scope -> IO a -> IO (Thread (Either e a)) +forkTry :: forall e a. (Exception e) => Scope -> IO a -> IO (Thread (Either e a)) forkTry scope = forkTryWith scope defaultThreadOptions @@ -370,7 +370,7 @@ data Result a | GoodResult a -- | Variant of 'Ki.forkTry' that takes an additional options argument. -forkTryWith :: forall e a. Exception e => Scope -> ThreadOptions -> IO a -> IO (Thread (Either e a)) +forkTryWith :: forall e a. (Exception e) => Scope -> ThreadOptions -> IO a -> IO (Thread (Either e a)) forkTryWith scope opts action = do resultVar <- newTVarIO NoResultYet let done result = UnexceptionalIO (atomically (writeTVar resultVar result))