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

Choreography.Network.Http

Description

This module implments the HTTP message transport backend for the Network monad.

Synopsis

Http configuration

newtype HttpConfig Source #

A backend for running Network behaviors over HTTP. The configuration specifies how locations are mapped to network hosts and ports.

Constructors

HttpConfig 

Instances

Instances details
Backend HttpConfig Source # 
Instance details

Defined in Choreography.Network.Http

Methods

runNetwork :: MonadIO m => HttpConfig -> LocTm -> Network m a -> m a Source #

type Host = String Source #

The address of a party/location.

type Port = Int Source #

The port of a party/location.

mkHttpConfig :: [(LocTm, (Host, Port))] -> HttpConfig Source #

Create a HTTP backend configuration from a association list that maps locations to network hosts and ports.

locs :: HttpConfig -> [LocTm] Source #

The list of locations known to a backend.

Receiving channels

type RecvChans = HashMap LocTm (Chan String) Source #

The channels a location uses to recieve messages from various peers.

mkRecvChans :: HttpConfig -> IO RecvChans Source #

Make the channels that will be used to recieve messages.

HTTP backend

runNetworkHttp :: MonadIO m => HttpConfig -> LocTm -> Network m a -> m a Source #

Run a Network behavior, using the provided HTTP backend.