extensible-effects-concurrent-0.3.0.2: Message passing concurrency as extensible-effect

Safe HaskellNone
LanguageHaskell2010

Control.Eff.Concurrent.Process.SingleThreadedScheduler

Description

A coroutine based, single threaded scheduler for Processes.

Synopsis

Documentation

schedule Source #

Arguments

:: Eff r ()

An that performs a yield w.r.t. the underlying effect r. E.g. if Lift IO is present, this might be: @lift yield.

-> Eff (Process r ': r) finalResult 
-> Eff r (Either String finalResult) 

Execute a Process and all the other processes spawned 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.

schedulePure :: Eff (ConsProcess '[]) a -> Either String a Source #

Like schedule but pure. The yield effect is just return (). schedulePure == run . schedule (return ()) @since 0.3.0.2

scheduleIO :: SetMember Lift (Lift IO) r => Eff (ConsProcess r) a -> Eff r (Either String a) Source #

Invoke schedule with lift yield as yield effect. @since 0.3.0.2

scheduleWithLogging :: Eff (ConsProcess '[Logs m]) a -> (Either String a, Seq m) Source #

Like schedulePure but with logging. scheduleWithLogging == run . captureLogs . schedule (return ()) @since 0.3.0.2

defaultMain :: HasCallStack => Eff '[Process '[Logs String, Lift IO], Logs String, Lift IO] () -> IO () Source #

Execute a Process using schedule on top of Lift IO and Logs String effects.

type LoggingAndIo = '[Logs String, Lift IO] Source #

The concrete list of Effects for running this pure scheduler on IO and with string logging.