Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Choreography.Network.Http
Description
This module implments the HTTP message transport backend for the Network
monad.
Synopsis
- newtype HttpConfig = HttpConfig {}
- type Host = String
- type Port = Int
- mkHttpConfig :: [(LocTm, (Host, Port))] -> HttpConfig
- locs :: HttpConfig -> [LocTm]
- type RecvChans = HashMap LocTm (Chan String)
- mkRecvChans :: HttpConfig -> IO RecvChans
- type API = "send" :> (Capture "from" LocTm :> (ReqBody '[PlainText] String :> PostNoContent))
- runNetworkHttp :: MonadIO m => HttpConfig -> LocTm -> Network m a -> m a
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
Backend HttpConfig Source # | |
Defined in Choreography.Network.Http Methods runNetwork :: MonadIO m => HttpConfig -> LocTm -> Network m a -> m a Source # |
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
type API = "send" :> (Capture "from" LocTm :> (ReqBody '[PlainText] String :> PostNoContent)) Source #
A Servant.API API.
runNetworkHttp :: MonadIO m => HttpConfig -> LocTm -> Network m a -> m a Source #
Run a Network
behavior, using the provided HTTP backend.