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 Effects () -> Eff LoggingAndIo ()
- defaultMain :: HasCallStack => Eff Effects () -> IO ()
- defaultMainWithLogWriter :: HasCallStack => LogWriter (Lift IO) -> Eff Effects () -> IO ()
- type SafeEffects = SafeProcesses BaseEffects
- type Effects = Processes BaseEffects
- type BaseEffects = Reader SchedulerState ': LoggingAndIo
- type HasBaseEffects r = (HasCallStack, Lifted IO r, BaseEffects <:: r)
Documentation
schedule :: HasCallStack => Eff Effects () -> 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 BaseEffects
effect for concurrent logging.
defaultMain :: HasCallStack => Eff Effects () -> IO () Source #
Start the message passing concurrency system then execute a Process
on
top of BaseEffects
effect. All logging is sent to standard output.
defaultMainWithLogWriter :: HasCallStack => LogWriter (Lift IO) -> Eff Effects () -> IO () Source #
Start the message passing concurrency system then execute a Process
on
top of BaseEffects
effect. All logging is sent to standard output.
type SafeEffects = SafeProcesses BaseEffects Source #
The concrete list of Eff
ects of processes compatible with this scheduler.
This builds upon BaseEffects
.
Since: 0.25.0
type Effects = Processes BaseEffects Source #
The Eff
ects for interruptable, concurrent processes, scheduled via forkIO
.
Since: 0.25.0
type BaseEffects = Reader SchedulerState ': LoggingAndIo Source #
The concrete list of Eff
ects for this scheduler implementation.
Since: 0.25.0
type HasBaseEffects r = (HasCallStack, Lifted IO r, BaseEffects <:: r) Source #
Type class constraint to indicate that an effect union contains the effects required by every process and the scheduler implementation itself.
Since: 0.25.0