Safe Haskell | None |
---|---|
Language | Haskell2010 |
Implement Erlang style message passing concurrency.
This module contains spawn
which handles the Process
effects, using
TQueue
s and withAsync
.
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 TVar
s
to manage processes with message queues.
Synopsis
- schedule :: HasCallStack => Eff InterruptableProcEff () -> Eff LoggingAndIo ()
- defaultMain :: HasCallStack => Eff InterruptableProcEff () -> IO ()
- defaultMainWithLogWriter :: HasCallStack => LogWriter IO -> Eff InterruptableProcEff () -> IO ()
- type ProcEff = ConsProcess SchedulerIO
- type InterruptableProcEff = InterruptableProcess SchedulerIO
- type SchedulerIO = Reader SchedulerState ': LoggingAndIo
- type HasSchedulerIO r = (HasCallStack, Lifted IO r, SchedulerIO <:: r)
Documentation
schedule :: 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 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.
defaultMainWithLogWriter :: HasCallStack => LogWriter IO -> 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.
type ProcEff = ConsProcess SchedulerIO Source #
The concrete list of Eff
ects 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 Eff
ects 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.