om-fork 0.7.1.9 → 0.7.1.10
raw patch · 2 files changed
+16/−18 lines, 2 filesdep +ki-unlifteddep −kiPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependencies added: ki-unlifted
Dependencies removed: ki
API changes (from Hackage documentation)
- OM.Fork: type Race = (?scope :: Scope)
+ OM.Fork: type Race = ?scope :: Scope
Files
- om-fork.cabal +2/−2
- src/OM/Fork.hs +14/−16
om-fork.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: om-fork-version: 0.7.1.9+version: 0.7.1.10 synopsis: Concurrency utilities. description: Actor pattern and some limited structured concurrency tools@@ -21,7 +21,7 @@ , aeson >= 2.0.3.0 && < 2.3 , base >= 4.15.1.0 && < 4.20 , exceptions >= 0.10.4 && < 0.11- , ki >= 1.0.0 && < 1.1+ , ki-unlifted >= 1.0.0.2 && < 1.1 , monad-logger >= 0.3.36 && < 0.4 , om-show >= 0.1.2.6 && < 0.2 , text >= 1.2.5.0 && < 2.2
src/OM/Fork.hs view
@@ -33,15 +33,17 @@ import Control.Monad (void) import Control.Monad.Catch (MonadThrow(throwM), MonadCatch, SomeException, try)-import Control.Monad.IO.Class (MonadIO, liftIO)+import Control.Monad.IO.Class (MonadIO(liftIO)) import Control.Monad.Logger.CallStack (MonadLogger, logInfo, logWarn)-import Data.Aeson (ToJSON, toJSON)+import Data.Aeson (ToJSON(toJSON)) import Data.String (IsString) import Data.Text (Text) import GHC.Conc (atomically) import OM.Show (showt)-import UnliftIO (MonadUnliftIO, askRunInIO, throwString)-import qualified Ki+import Prelude (Either(Left, Right), Monad((>>=), return),+ Semigroup((<>)), Show(show), ($), (.), IO, Monoid)+import UnliftIO (MonadUnliftIO, throwString)+import qualified Ki.Unlifted as Ki {- | How to respond to a asynchronous message. -}@@ -157,9 +159,8 @@ => (Race => m a) {- ^ - @action@: The provided "race" action. -} -> m a runRace action = do- runInIO <- askRunInIO- liftIO . Ki.scoped $ \scope ->- runInIO (let ?scope = scope in action)+ Ki.scoped $ \scope ->+ let ?scope = scope in action {- |@@ -189,15 +190,12 @@ -> m a -> m () race name action = do- runInIO <- askRunInIO- liftIO- . Ki.fork_ ?scope- $ do- tid <- myThreadId- runInIO . logUnexpectedTermination name $ do- logInfo $ "Starting thread (tid, name): " <> showt (tid, name)- void action- throwString $ "Thread Finished (tid, name): " <> show (tid, name)+ Ki.fork_ ?scope $ do+ tid <- liftIO myThreadId+ logUnexpectedTermination name $ do+ logInfo $ "Starting thread (tid, name): " <> showt (tid, name)+ void action+ throwString $ "Thread Finished (tid, name): " <> show (tid, name) {- | The name of a process. -}