Safe Haskell | None |
---|---|
Language | Haskell2010 |
A coroutine based, single threaded scheduler for Process
es.
Synopsis
- scheduleM :: forall m r a. Monad m => (forall b. Eff r b -> m b) -> m () -> Eff (InterruptableProcess r) a -> m (Either (ExitReason NoRecovery) a)
- schedulePure :: Eff (InterruptableProcess '[Logs LogMessage]) a -> Either (ExitReason NoRecovery) a
- scheduleIO :: MonadIO m => (forall b. Eff r b -> Eff '[Lift m] b) -> Eff (InterruptableProcess r) a -> m (Either (ExitReason NoRecovery) a)
- scheduleMonadIOEff :: MonadIO (Eff r) => Eff (InterruptableProcess r) a -> Eff r (Either (ExitReason NoRecovery) a)
- scheduleIOWithLogging :: NFData l => LogWriter l IO -> Eff (InterruptableProcess '[Logs l, LogWriterReader l IO, Lift IO]) a -> IO (Either (ExitReason NoRecovery) a)
- defaultMainSingleThreaded :: HasCallStack => Eff (InterruptableProcess '[Logs LogMessage, LogWriterReader LogMessage IO, Lift IO]) () -> IO ()
- singleThreadedIoScheduler :: SchedulerProxy LoggingAndIo
Documentation
:: Monad m | |
=> (forall b. Eff r b -> m b) | |
-> m () | An that performs a yield w.r.t. the underlying effect
|
-> Eff (InterruptableProcess r) a | |
-> m (Either (ExitReason NoRecovery) a) |
Handle the Process
effect, as well as all lower effects using an effect handler function.
Execute the main Process
and all the other processes spawn
ed by it in the
current thread concurrently, using a co-routine based, round-robin
scheduler. If a process exits with exitNormally
, exitWithError
,
raiseError
or is killed by another process Left ...
is returned.
Otherwise, the result will be wrapped in a Right
.
Every time a process _yields_ the effects are evaluated down to the a value
of type m (Either String a)
.
If the evaluator function runs the action down e.g. IO
this might improve
memory consumption, for long running services, with processes that loop
endlessly.
Since: 0.4.0.0
schedulePure :: Eff (InterruptableProcess '[Logs LogMessage]) a -> Either (ExitReason NoRecovery) a Source #
Like schedule
but pure. The yield
effect is just return ()
.
schedulePure == runIdentity .
scheduleM
(Identity . run) (return ())
Since: 0.3.0.2
scheduleIO :: MonadIO m => (forall b. Eff r b -> Eff '[Lift m] b) -> Eff (InterruptableProcess r) a -> m (Either (ExitReason NoRecovery) a) Source #
scheduleMonadIOEff :: MonadIO (Eff r) => Eff (InterruptableProcess r) a -> Eff r (Either (ExitReason NoRecovery) a) Source #
scheduleIOWithLogging :: NFData l => LogWriter l IO -> Eff (InterruptableProcess '[Logs l, LogWriterReader l IO, Lift IO]) a -> IO (Either (ExitReason NoRecovery) a) Source #
defaultMainSingleThreaded :: HasCallStack => Eff (InterruptableProcess '[Logs LogMessage, LogWriterReader LogMessage IO, Lift IO]) () -> IO () Source #
singleThreadedIoScheduler :: SchedulerProxy LoggingAndIo Source #
A SchedulerProxy
for LoggingAndIo
.