polysemy-conc 0.5.0.0 → 0.5.1.0
raw patch · 7 files changed
+43/−10 lines, 7 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Polysemy.Conc: interpretInterruptNull :: InterpreterFor Interrupt r
+ Polysemy.Conc.Interpreter.Interrupt: interpretInterruptNull :: InterpreterFor Interrupt r
- Polysemy.Conc: interpretQueueListReadOnlyState :: forall d r. Member (Embed IO) r => [d] -> InterpreterFor (Queue d) r
+ Polysemy.Conc: interpretQueueListReadOnlyState :: forall d r. [d] -> InterpreterFor (Queue d) r
- Polysemy.Conc.Interpreter.Queue.Pure: interpretQueueListReadOnlyState :: forall d r. Member (Embed IO) r => [d] -> InterpreterFor (Queue d) r
+ Polysemy.Conc.Interpreter.Queue.Pure: interpretQueueListReadOnlyState :: forall d r. [d] -> InterpreterFor (Queue d) r
Files
- lib/Polysemy/Conc.hs +3/−2
- lib/Polysemy/Conc/Effect/Monitor.hs +10/−1
- lib/Polysemy/Conc/Interpreter/Interrupt.hs +23/−1
- lib/Polysemy/Conc/Interpreter/Monitor.hs +1/−1
- lib/Polysemy/Conc/Interpreter/Queue/Pure.hs +0/−1
- lib/Polysemy/Conc/Monitor.hs +4/−2
- polysemy-conc.cabal +2/−2
lib/Polysemy/Conc.hs view
@@ -7,7 +7,6 @@ -- $queue Queue, QueueResult,- resultToMaybe, -- ** Interpreters interpretQueueTBM,@@ -18,6 +17,7 @@ interpretQueueListReadOnlyStateWith, -- ** Combinators+ resultToMaybe, loop, loopOr, @@ -58,6 +58,7 @@ -- ** Interpreters interpretInterrupt, interpretInterruptOnce,+ interpretInterruptNull, -- * Event Channels Events,@@ -162,7 +163,7 @@ import Polysemy.Conc.Events (subscribeLoop, subscribeWhile) import Polysemy.Conc.Interpreter.Critical (interpretCritical, interpretCriticalNull) import Polysemy.Conc.Interpreter.Events (ChanConsumer, ChanEvents, EventChan, EventConsumer, interpretEventsChan)-import Polysemy.Conc.Interpreter.Interrupt (interpretInterrupt, interpretInterruptOnce)+import Polysemy.Conc.Interpreter.Interrupt (interpretInterrupt, interpretInterruptNull, interpretInterruptOnce) import Polysemy.Conc.Interpreter.Mask (interpretMaskFinal, interpretUninterruptibleMaskFinal) import Polysemy.Conc.Interpreter.Monitor (interpretMonitorPure, interpretMonitorRestart) import Polysemy.Conc.Interpreter.Queue.Pure (
lib/Polysemy/Conc/Effect/Monitor.hs view
@@ -2,10 +2,12 @@ -- |Description: Monitor Effect, Internal module Polysemy.Conc.Effect.Monitor where +import Polysemy (makeSem_) import Polysemy.Time (NanoSeconds) import Polysemy.Conc.Effect.Scoped (Scoped, scoped) +-- |Marker type for the restarting action for 'Monitor'. data Restart = Restart deriving (Eq, Show)@@ -17,7 +19,14 @@ data Monitor (action :: Type) :: Effect where Monitor :: m a -> Monitor action m a -makeSem ''Monitor+makeSem_ ''Monitor++-- |Mark a region as being subject to intervention by a monitoring program.+monitor ::+ ∀ action r a .+ Member (Monitor action) r =>+ Sem r a ->+ Sem r a -- |Marker type for a 'Scoped' 'Monitor'. newtype MonitorResource a =
lib/Polysemy/Conc/Interpreter/Interrupt.hs view
@@ -12,7 +12,7 @@ import Polysemy.AtomicState (runAtomicStateTVar) import Polysemy.Internal.Tactics (liftT) import Polysemy.Time (Seconds (Seconds))-import System.Posix.Signals (Handler (CatchInfo, CatchInfoOnce, CatchOnce), SignalInfo, installHandler, keyboardSignal)+import System.Posix.Signals (Handler (CatchInfo, CatchInfoOnce, CatchOnce, Catch), SignalInfo, installHandler, keyboardSignal) import qualified Polysemy.Conc.Effect.Critical as Critical import Polysemy.Conc.Effect.Critical (Critical)@@ -167,6 +167,10 @@ (const thunk) originalHandler (CatchInfoOnce thunk) = thunk+originalHandler (Catch thunk) =+ (const thunk)+originalHandler (CatchInfo thunk) =+ thunk originalHandler _ = const pass {-# inline originalHandler #-}@@ -214,3 +218,21 @@ InterpreterFor Interrupt r interpretInterruptOnce = interpretInterruptWith CatchInfoOnce++-- |Eliminate 'Interrupt' without interpreting.+interpretInterruptNull ::+ InterpreterFor Interrupt r+interpretInterruptNull =+ interpretH \case+ Register _ _ ->+ pureT ()+ Unregister _ ->+ pureT ()+ WaitQuit ->+ pureT ()+ Quit ->+ pureT ()+ Interrupted ->+ pureT False+ KillOnQuit _ _ ->+ pureT Nothing
lib/Polysemy/Conc/Interpreter/Monitor.hs view
@@ -53,7 +53,7 @@ void (embedFinal @IO (tryTakeMVar sig)) leftM (spin sig) =<< errorToIOFinal @MonitorCancel (fromExceptionSem @MonitorCancel (raise (run res))) --- |Interpret @'Scoped' 'Monitor'@ with the 'Restart' strategy.+-- |Interpret @'Polysemy.Conc.Scoped' 'Monitor'@ with the 'Polysemy.Conc.Restart' strategy. -- This takes a check action that may put an 'MVar' when the scoped region should be restarted. -- The check is executed in a loop, with an interval given in 'MonitorCheck'. interpretMonitorRestart ::
lib/Polysemy/Conc/Interpreter/Queue/Pure.hs view
@@ -105,7 +105,6 @@ -- |Variant of 'interpretQueueListReadOnlyAtomicWith' that interprets the 'State'. interpretQueueListReadOnlyState :: ∀ d r .- Member (Embed IO) r => [d] -> InterpreterFor (Queue d) r interpretQueueListReadOnlyState ds sem = do
lib/Polysemy/Conc/Monitor.hs view
@@ -1,11 +1,13 @@+{-# options_haddock prune #-}+-- |Description: Monitor Implementations, Internal module Polysemy.Conc.Monitor where +import Data.Default (Default (def)) import qualified Polysemy.Time as Time-import Polysemy.Time (NanoSeconds, Time, TimeUnit, convert, Minutes (Minutes), Seconds (Seconds))+import Polysemy.Time (Minutes (Minutes), NanoSeconds, Seconds (Seconds), Time, TimeUnit, convert) import Torsor (Torsor, difference, minus) import Polysemy.Conc.Effect.Monitor (MonitorCheck (MonitorCheck))-import Data.Default (Default (def)) -- |Config for 'monitorClockSkew'. data ClockSkewConfig =
polysemy-conc.cabal view
@@ -5,14 +5,14 @@ -- see: https://github.com/sol/hpack name: polysemy-conc-version: 0.5.0.0+version: 0.5.1.0 synopsis: Polysemy Effects for Concurrency description: See <https://hackage.haskell.org/package/polysemy-conc/docs/Polysemy-Conc.html> category: Concurrency homepage: https://github.com/tek/polysemy-conc#readme bug-reports: https://github.com/tek/polysemy-conc/issues author: Torsten Schmits-maintainer: tek@tryp.io+maintainer: haskell@tryp.io copyright: 2021 Torsten Schmits license: BSD-2-Clause-Patent license-file: LICENSE