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

Safe HaskellNone
LanguageHaskell2010

Control.Eff.Concurrent.Process.ForkIOScheduler

Description

Implement Erlang style message passing concurrency.

This handles the MessagePassing and Process effects, using TQueues and forkIO.

This aims to be a pragmatic implementation, so even logging is supported.

At the core is a main process that enters schedule and creates all of the internal state stored in TVars to manage processes with message queues.

The Eff handler for Process and MessagePassing use are implemented and available through spawn.

Synopsis

Documentation

schedule :: (HasLogging IO SchedulerIO, HasCallStack) => Eff InterruptableProcEff () -> Eff LoggingAndIO () Source #

This is the main entry point to running a message passing concurrency application. This function takes a Process on top of the SchedulerIO effect and a LogChannel for concurrent logging.

defaultMain :: HasCallStack => Eff InterruptableProcEff () -> IO () Source #

Start the message passing concurrency system then execute a Process on top of SchedulerIO effect. All logging is sent to standard output.

defaultMainWithLogChannel :: HasCallStack => Eff InterruptableProcEff () -> LogChannel LogMessage -> IO () Source #

Start the message passing concurrency system then execute a Process on top of SchedulerIO effect. All logging is sent to standard output.

type ProcEff = ConsProcess SchedulerIO Source #

The concrete list of Effects of processes compatible with this scheduler. This builds upon SchedulerIO.

type InterruptableProcEff = InterruptableProcess SchedulerIO Source #

The concrete list of the effects, that the Process uses

type SchedulerIO = Reader SchedulerState ': LoggingAndIO Source #

The concrete list of Effects for this scheduler implementation.

type HasSchedulerIO r = (HasCallStack, Lifted IO r, SchedulerIO <:: r) Source #

Type class constraint to indicate that an effect union contains the effects required by every process and the scheduler implementation itself.