Safe Haskell | None |
---|---|
Language | Haskell2010 |
Functions for protocol clients.
This modules is required to write clients that sendPdu
s.
Synopsis
- cast :: forall destination protocol r q. (HasCallStack, HasProcesses r q, HasPdu destination, HasPdu protocol, Tangible (Pdu destination Asynchronous), Embeds destination protocol) => Endpoint destination -> Pdu protocol Asynchronous -> Eff r ()
- call :: forall result destination protocol r q. (HasProcesses r q, TangiblePdu destination (Synchronous result), TangiblePdu protocol (Synchronous result), Tangible result, Embeds destination protocol, HasCallStack) => Endpoint destination -> Pdu protocol (Synchronous result) -> Eff r result
- callWithTimeout :: forall result destination protocol r q. (HasProcesses r q, TangiblePdu destination (Synchronous result), TangiblePdu protocol (Synchronous result), Tangible result, Member Logs r, Lifted IO q, Lifted IO r, HasCallStack, Embeds destination protocol) => Endpoint destination -> Pdu protocol (Synchronous result) -> Timeout -> Eff r result
- castSingleton :: forall outer inner q e. (HasCallStack, Member (EndpointReader outer) e, Tangible (Pdu outer Asynchronous), HasProcesses e q, HasPdu outer, HasPdu inner, Embeds outer inner, Embeds outer outer) => Pdu inner Asynchronous -> Eff e ()
- castEndpointReader :: forall o r q. (HasEndpointReader o r, HasProcesses r q, Tangible (Pdu o Asynchronous), HasCallStack, HasPdu o, Embeds o o) => Pdu o Asynchronous -> Eff r ()
- callSingleton :: forall outer inner reply q e. (HasCallStack, Member (EndpointReader outer) e, Embeds outer inner, Embeds outer outer, HasProcesses e q, TangiblePdu outer (Synchronous reply), TangiblePdu inner (Synchronous reply), Tangible reply) => Pdu inner (Synchronous reply) -> Eff e reply
- callEndpointReader :: forall reply o r q. (HasEndpointReader o r, HasCallStack, Tangible reply, TangiblePdu o (Synchronous reply), HasProcesses r q, Embeds o o) => Pdu o (Synchronous reply) -> Eff r reply
- type HasEndpointReader o r = (Typeable o, Member (EndpointReader o) r)
- type EndpointReader o = Reader (Endpoint o)
- askEndpoint :: Member (EndpointReader o) e => Eff e (Endpoint o)
- runEndpointReader :: HasCallStack => Endpoint o -> Eff (EndpointReader o ': r) a -> Eff r a
Calling APIs directly
cast :: forall destination protocol r q. (HasCallStack, HasProcesses r q, HasPdu destination, HasPdu protocol, Tangible (Pdu destination Asynchronous), Embeds destination protocol) => Endpoint destination -> Pdu protocol Asynchronous -> Eff r () Source #
Send a request Pdu
that has no reply and return immediately.
The type signature enforces that the corresponding Pdu
clause is
Asynchronous
. The operation never fails, if it is important to know if the
message was delivered, use call
instead.
The message will be reduced to normal form (rnf
) in the caller process.
call :: forall result destination protocol r q. (HasProcesses r q, TangiblePdu destination (Synchronous result), TangiblePdu protocol (Synchronous result), Tangible result, Embeds destination protocol, HasCallStack) => Endpoint destination -> Pdu protocol (Synchronous result) -> Eff r result Source #
Send a request Pdu
and wait for the server to return a result value.
The type signature enforces that the corresponding Pdu
clause is
Synchronous
.
Always prefer callWithTimeout
over call
callWithTimeout :: forall result destination protocol r q. (HasProcesses r q, TangiblePdu destination (Synchronous result), TangiblePdu protocol (Synchronous result), Tangible result, Member Logs r, Lifted IO q, Lifted IO r, HasCallStack, Embeds destination protocol) => Endpoint destination -> Pdu protocol (Synchronous result) -> Timeout -> Eff r result Source #
Send an request Pdu
and wait for the server to return a result value.
The type signature enforces that the corresponding Pdu
clause is
Synchronous
.
If the server that was called dies, this function interrupts the
process with ProcessDown
.
If the server takes longer to reply than the given timeout, this
function interrupts the process with TimeoutInterrupt
.
Always prefer this function over call
Since: 0.22.0
Server Process Registration
castSingleton :: forall outer inner q e. (HasCallStack, Member (EndpointReader outer) e, Tangible (Pdu outer Asynchronous), HasProcesses e q, HasPdu outer, HasPdu inner, Embeds outer inner, Embeds outer outer) => Pdu inner Asynchronous -> Eff e () Source #
Like castEndpointReader
, but uses embedPdu
to embed the value.
This function makes use of AmbigousTypes and TypeApplications.
When not working with an embedded Pdu
use castEndpointReader
.
Since: 0.25.1
castEndpointReader :: forall o r q. (HasEndpointReader o r, HasProcesses r q, Tangible (Pdu o Asynchronous), HasCallStack, HasPdu o, Embeds o o) => Pdu o Asynchronous -> Eff r () Source #
Like cast
but take the Endpoint
from the reader provided by
runEndpointReader
.
When working with an embedded Pdu
use castSingleton
.
callSingleton :: forall outer inner reply q e. (HasCallStack, Member (EndpointReader outer) e, Embeds outer inner, Embeds outer outer, HasProcesses e q, TangiblePdu outer (Synchronous reply), TangiblePdu inner (Synchronous reply), Tangible reply) => Pdu inner (Synchronous reply) -> Eff e reply Source #
Like callEndpointReader
, uses embedPdu
to embed the value.
This function makes use of AmbigousTypes and TypeApplications.
When not working with an embedded Pdu
use callEndpointReader
.
Since: 0.25.1
callEndpointReader :: forall reply o r q. (HasEndpointReader o r, HasCallStack, Tangible reply, TangiblePdu o (Synchronous reply), HasProcesses r q, Embeds o o) => Pdu o (Synchronous reply) -> Eff r reply Source #
Like call
but take the Endpoint
from the reader provided by
runEndpointReader
.
When working with an embedded Pdu
use callSingleton
.
type HasEndpointReader o r = (Typeable o, Member (EndpointReader o) r) Source #
type EndpointReader o = Reader (Endpoint o) Source #
The reader effect for ProcessId
s for Pdu
s, see runEndpointReader
askEndpoint :: Member (EndpointReader o) e => Eff e (Endpoint o) Source #
Get the Endpoint
registered with runEndpointReader
.
runEndpointReader :: HasCallStack => Endpoint o -> Eff (EndpointReader o ': r) a -> Eff r a Source #
Run a reader effect that contains the one server handling a specific
Pdu
instance.