MultiChor-1.0.1.1: Type-safe and efficient choreographies with location-set polymorphism.
Safe HaskellSafe-Inferred
LanguageGHC2021

Choreography.Network.Local

Description

This module defines the multi-thread backend for the Network monad.

Synopsis

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.

Constructors

LocalConfig 

Instances

Instances details
Backend LocalConfig Source # 
Instance details

Defined in Choreography.Network.Local

Methods

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.