| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Control.Eff.Concurrent.Protocol.Wrapper
Description
Proxies and containers for casts and calls.
Since: 0.15.0
Synopsis
- data Request protocol where
- Call :: forall protocol reply. (Tangible reply, TangiblePdu protocol (Synchronous reply)) => RequestOrigin protocol reply -> Pdu protocol (Synchronous reply) -> Request protocol
- Cast :: forall protocol. (TangiblePdu protocol Asynchronous, NFData (Pdu protocol Asynchronous)) => Pdu protocol Asynchronous -> Request protocol
- sendReply :: (HasProcesses eff q, Tangible reply, Typeable protocol) => ReplyTarget protocol reply -> reply -> Eff eff ()
- newtype ReplyTarget p r = MkReplyTarget (Arg (RequestOrigin p r) (Serializer (Reply p r)))
- replyTarget :: Serializer (Reply p reply) -> RequestOrigin p reply -> ReplyTarget p reply
- replyTargetOrigin :: Lens' (ReplyTarget p reply) (RequestOrigin p reply)
- replyTargetSerializer :: Lens' (ReplyTarget p reply) (Serializer (Reply p reply))
- embeddedReplyTarget :: Embeds outer inner => Serializer (Reply outer reply) -> RequestOrigin outer reply -> ReplyTarget inner reply
- toEmbeddedReplyTarget :: Embeds outer inner => ReplyTarget outer reply -> ReplyTarget inner reply
- data RequestOrigin (proto :: Type) reply = RequestOrigin {}
- embedRequestOrigin :: forall outer inner reply. Embeds outer inner => RequestOrigin inner reply -> RequestOrigin outer reply
- toEmbeddedOrigin :: forall outer inner reply. Embeds outer inner => RequestOrigin outer reply -> RequestOrigin inner reply
- data Reply protocol reply where
- embedReplySerializer :: forall outer inner reply. Embeds outer inner => Serializer (Reply outer reply) -> Serializer (Reply inner reply)
- makeRequestOrigin :: (Typeable r, NFData r, HasProcesses e q0) => Eff e (RequestOrigin p r)
Documentation
data Request protocol where Source #
A wrapper sum type for calls and casts for the Pdus of a protocol
Since: 0.15.0
Constructors
| Call :: forall protocol reply. (Tangible reply, TangiblePdu protocol (Synchronous reply)) => RequestOrigin protocol reply -> Pdu protocol (Synchronous reply) -> Request protocol | |
| Cast :: forall protocol. (TangiblePdu protocol Asynchronous, NFData (Pdu protocol Asynchronous)) => Pdu protocol Asynchronous -> Request protocol |
sendReply :: (HasProcesses eff q, Tangible reply, Typeable protocol) => ReplyTarget protocol reply -> reply -> Eff eff () Source #
Answer a Call by sending the reply value to the client process.
The ProcessId, the RequestOrigin and the Reply Serializer are
stored in the ReplyTarget.
Since: 0.25.1
newtype ReplyTarget p r Source #
Target of a Call reply.
This combines a RequestOrigin with a Serializer for a Reply using Arg.
There are to smart constructors for this type: replyTarget and embeddedReplyTarget.
Because of Arg the Eq and Ord instances are implemented via
the RequestOrigin instances.
Since: 0.26.0
Constructors
| MkReplyTarget (Arg (RequestOrigin p r) (Serializer (Reply p r))) |
Instances
replyTarget :: Serializer (Reply p reply) -> RequestOrigin p reply -> ReplyTarget p reply Source #
Smart constructor for a ReplyTarget.
To build a ReplyTarget for an Embeds instance use embeddedReplyTarget.
Since: 0.26.0
replyTargetOrigin :: Lens' (ReplyTarget p reply) (RequestOrigin p reply) Source #
A simple Lens for the RequestOrigin of a ReplyTarget.
Since: 0.26.0
replyTargetSerializer :: Lens' (ReplyTarget p reply) (Serializer (Reply p reply)) Source #
A simple Lens for the Reply Serializer of a ReplyTarget.
Since: 0.26.0
embeddedReplyTarget :: Embeds outer inner => Serializer (Reply outer reply) -> RequestOrigin outer reply -> ReplyTarget inner reply Source #
Smart constructor for an embedded ReplyTarget.
This combines replyTarget and toEmbeddedReplyTarget.
Since: 0.26.0
toEmbeddedReplyTarget :: Embeds outer inner => ReplyTarget outer reply -> ReplyTarget inner reply Source #
Convert a ReplyTarget to be usable for embedded replies.
This combines a toEmbeddedOrigin with embedReplySerializer to produce a
ReplyTarget that can be passed to functions defined soley on an embedded protocol.
Since: 0.26.0
data RequestOrigin (proto :: Type) reply Source #
Constructors
| RequestOrigin | |
Fields | |
Instances
embedRequestOrigin :: forall outer inner reply. Embeds outer inner => RequestOrigin inner reply -> RequestOrigin outer reply Source #
Turn an embedded RequestOrigin to a RequestOrigin for the bigger request.
This is the inverse of toEmbeddedOrigin.
This function is strict in all parameters.
Since: 0.24.2
toEmbeddedOrigin :: forall outer inner reply. Embeds outer inner => RequestOrigin outer reply -> RequestOrigin inner reply Source #
Turn an RequestOrigin to an origin for an embedded request (See Embeds).
This is useful of a server delegates the calls and casts for an embedded protocol
to functions, that require the Serializer and RequestOrigin in order to call
sendReply.
See also embedReplySerializer.
Since: 0.24.3
data Reply protocol reply where Source #
The wrapper around replies to Calls.
Since: 0.15.0
Constructors
| Reply | |
Fields
| |
embedReplySerializer :: forall outer inner reply. Embeds outer inner => Serializer (Reply outer reply) -> Serializer (Reply inner reply) Source #
Turn a Serializer for a Pdu instance that contains embedded Pdu values
into a Reply Serializer for the embedded Pdu.
This is useful of a server delegates the calls and casts for an embedded protocol
to functions, that require the Serializer and RequestOrigin in order to call
sendReply.
See also toEmbeddedOrigin.
Since: 0.24.2
makeRequestOrigin :: (Typeable r, NFData r, HasProcesses e q0) => Eff e (RequestOrigin p r) Source #
Create a new, unique RequestOrigin value for the current process.
Since: 0.24.0