Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- cast :: forall r q o. (HasCallStack, SetMember Process (Process q) r, PrettyTypeShow (ToPretty o), Member Interrupts r, Typeable o, Typeable (Api o Asynchronous), NFData (Api o Asynchronous)) => Server o -> Api o Asynchronous -> Eff r ()
- call :: forall result api r q. (SetMember Process (Process q) r, Member Interrupts r, Typeable api, PrettyTypeShow (ToPretty api), Typeable (Api api (Synchronous result)), NFData (Api api (Synchronous result)), Typeable result, NFData result, Show result, HasCallStack) => Server api -> Api api (Synchronous result) -> Eff r result
- callWithTimeout :: forall result api r q. (SetMember Process (Process q) r, Member Interrupts r, Typeable api, Typeable (Api api (Synchronous result)), NFData (Api api (Synchronous result)), Typeable result, NFData result, Show result, Member Logs r, Lifted IO q, Lifted IO r, HasCallStack, PrettyTypeShow (ToPretty api)) => Server api -> Api api (Synchronous result) -> Timeout -> Eff r result
- castRegistered :: (Typeable o, ServesApi o r q, HasCallStack, Member Interrupts r, NFData (Api o Asynchronous)) => Api o Asynchronous -> Eff r ()
- callRegistered :: (Typeable reply, ServesApi o r q, HasCallStack, NFData reply, Show reply, NFData (Api o (Synchronous reply)), Member Interrupts r) => Api o (Synchronous reply) -> Eff r reply
- type ServesApi o r q = (Typeable o, PrettyTypeShow (ToPretty o), SetMember Process (Process q) r, Member (ServerReader o) r)
- type ServerReader o = Reader (Server o)
- whereIsServer :: Member (ServerReader o) e => Eff e (Server o)
- registerServer :: HasCallStack => Server o -> Eff (ServerReader o ': r) a -> Eff r a
Calling APIs directly
cast :: forall r q o. (HasCallStack, SetMember Process (Process q) r, PrettyTypeShow (ToPretty o), Member Interrupts r, Typeable o, Typeable (Api o Asynchronous), NFData (Api o Asynchronous)) => Server o -> Api o Asynchronous -> Eff r () Source #
Send an Api
request that has no return value and return as fast as
possible. The type signature enforces that the corresponding Api
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 api r q. (SetMember Process (Process q) r, Member Interrupts r, Typeable api, PrettyTypeShow (ToPretty api), Typeable (Api api (Synchronous result)), NFData (Api api (Synchronous result)), Typeable result, NFData result, Show result, HasCallStack) => Server api -> Api api (Synchronous result) -> Eff r result Source #
Send an Api
request and wait for the server to return a result value.
The type signature enforces that the corresponding Api
clause is
Synchronous
.
Always prefer callWithTimeout
over call
callWithTimeout :: forall result api r q. (SetMember Process (Process q) r, Member Interrupts r, Typeable api, Typeable (Api api (Synchronous result)), NFData (Api api (Synchronous result)), Typeable result, NFData result, Show result, Member Logs r, Lifted IO q, Lifted IO r, HasCallStack, PrettyTypeShow (ToPretty api)) => Server api -> Api api (Synchronous result) -> Timeout -> Eff r result Source #
Send an Api
request and wait for the server to return a result value.
The type signature enforces that the corresponding Api
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
castRegistered :: (Typeable o, ServesApi o r q, HasCallStack, Member Interrupts r, NFData (Api o Asynchronous)) => Api o Asynchronous -> Eff r () Source #
Like cast
but take the Server
from the reader provided by
registerServer
.
callRegistered :: (Typeable reply, ServesApi o r q, HasCallStack, NFData reply, Show reply, NFData (Api o (Synchronous reply)), Member Interrupts r) => Api o (Synchronous reply) -> Eff r reply Source #
Like call
but take the Server
from the reader provided by
registerServer
.
type ServesApi o r q = (Typeable o, PrettyTypeShow (ToPretty o), SetMember Process (Process q) r, Member (ServerReader o) r) Source #
type ServerReader o = Reader (Server o) Source #
The reader effect for ProcessId
s for Api
s, see registerServer
whereIsServer :: Member (ServerReader o) e => Eff e (Server o) Source #
Get the Server
registered with registerServer
.
registerServer :: HasCallStack => Server o -> Eff (ServerReader o ': r) a -> Eff r a Source #
Run a reader effect that contains the one server handling a specific
Api
instance.