Skip to content

Commit

Permalink
format with new ormolu
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchellwrosen committed Nov 28, 2023
1 parent 0b1c21f commit 90210c9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ki/src/Ki/Internal/IO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
8 changes: 4 additions & 4 deletions ki/src/Ki/Internal/Scope.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -58,7 +59,6 @@ import Ki.Internal.IO
uninterruptiblyMasked,
)
import Ki.Internal.Thread
import Data.Maybe (isJust)

-- | A scope.
--
Expand Down Expand Up @@ -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

Expand All @@ -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))
Expand Down

0 comments on commit 90210c9

Please sign in to comment.