Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
This module defines the multi-thread backend for the Network
monad.
Synopsis
- type MsgBuf = HashMap LocTm (Chan String)
- newtype LocalConfig = LocalConfig {}
- newEmptyMsgBuf :: [LocTm] -> IO MsgBuf
- mkLocalConfig :: [LocTm] -> IO LocalConfig
- locs :: LocalConfig -> [LocTm]
- runNetworkLocal :: MonadIO m => LocalConfig -> LocTm -> Network m a -> m a
Documentation
type MsgBuf = HashMap LocTm (Chan String) Source #
Each location is associated with a message buffer which stores messages sent from other locations.
newtype LocalConfig Source #
A backend for running choreographies using Haskell threads
as the locations and buffered Chan
channels for communication.
Instances
Backend LocalConfig Source # | |
Defined in Choreography.Network.Local runNetwork :: MonadIO m => LocalConfig -> LocTm -> Network m a -> m a Source # |
newEmptyMsgBuf :: [LocTm] -> IO MsgBuf Source #
Make a channel for each of the listed locations, on which messages from that location can be recieved.
mkLocalConfig :: [LocTm] -> IO LocalConfig Source #
Make a local backend for the listed parties. Make just the one backend and then have all your threads use the same one.
locs :: LocalConfig -> [LocTm] Source #
List the parties known to the backend.
runNetworkLocal :: MonadIO m => LocalConfig -> LocTm -> Network m a -> m a Source #
Run a Network
behavior using the channels in a LocalConfig
for communication.
Call this inside a concurrent thread.