Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 Pdu
s of a protocol
Since: 0.15.0
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
MkReplyTarget (Arg (RequestOrigin p r) (Serializer (Reply p r))) |
Instances
Eq (ReplyTarget p r) Source # | |
Defined in Control.Eff.Concurrent.Protocol.Wrapper (==) :: ReplyTarget p r -> ReplyTarget p r -> Bool # (/=) :: ReplyTarget p r -> ReplyTarget p r -> Bool # | |
Ord (ReplyTarget p r) Source # | |
Defined in Control.Eff.Concurrent.Protocol.Wrapper compare :: ReplyTarget p r -> ReplyTarget p r -> Ordering # (<) :: ReplyTarget p r -> ReplyTarget p r -> Bool # (<=) :: ReplyTarget p r -> ReplyTarget p r -> Bool # (>) :: ReplyTarget p r -> ReplyTarget p r -> Bool # (>=) :: ReplyTarget p r -> ReplyTarget p r -> Bool # max :: ReplyTarget p r -> ReplyTarget p r -> ReplyTarget p r # min :: ReplyTarget p r -> ReplyTarget p r -> ReplyTarget p r # | |
Show (ReplyTarget p r) Source # | |
Defined in Control.Eff.Concurrent.Protocol.Wrapper showsPrec :: Int -> ReplyTarget p r -> ShowS # show :: ReplyTarget p r -> String # showList :: [ReplyTarget p r] -> ShowS # | |
NFData (ReplyTarget p r) Source # | |
Defined in Control.Eff.Concurrent.Protocol.Wrapper rnf :: ReplyTarget p r -> () # |
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 #
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 Call
s.
Since: 0.15.0
Reply | |
|
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