sessiontypes-distributed-0.1.1: Session types distributed

Safe HaskellNone
LanguageHaskell2010

Control.Distributed.Session

Contents

Description

This package defines a wrapper over the sessiontypes library that allows for evaluating session typed programs to Cloud Haskell programs.

The goal of this library is to allow a user to define two dual session typed programs, spawn two processes and have these processes evaluate the programs.

Session types guarantee that the resulting Cloud Haskell programs correctly implement the protocol and that they are non-deadlocking.

We define a session typed program with an indexed monad Session that is both a reader monad and a wrapper over a STTerm that uses Process as its underlying monad.

This module exports the most important parts of this library:

Additionally we defined wrappers for using the interpreters defined in the sessiontypes package on a Session:

Synopsis

Core

Session

Data types

newtype Session s r a Source #

Session is defined as a newtype wrapper over a function that takes a `Maybe SessionInfo` and returns an indexed codensity monad transformer over the Process monad.

Session is also a reader monad that has a Maybe SessionInfo as its environment. SessionInfo is wrapped in a Maybe, because we also allow a session to be run singularly. In which case there is no other Session to communicate with and therefore is there also no need for a SessionInfo.

The function returns the indexed codensity monad and not simply a STTerm, because from benchmarking the codensity monad gave us significant performance improvements for free.

Constructors

Session 

Instances

MonadSession Session Source # 

Methods

send :: a -> Session (Cap * ctx ((* :!> a) r)) (Cap * ctx r) () #

recv :: Session (Cap * ctx ((* :?> a) r)) (Cap * ctx r) a #

sel1 :: Session (Cap * ctx (Sel * ((ST * ': s) xs))) (Cap * ctx s) () #

sel2 :: Session (Cap * ctx (Sel * ((ST * ': s) ((ST * ': t) xs)))) (Cap * ctx (Sel * ((ST * ': t) xs))) () #

offZ :: Session (Cap * ctx s) r a -> Session (Cap * ctx (Off * ((ST * ': s) [ST *]))) r a #

offS :: Session (Cap * ctx s) r a -> Session (Cap * ctx (Off * ((ST * ': t) xs))) r a -> Session (Cap * ctx (Off * ((ST * ': s) ((ST * ': t) xs)))) r a #

recurse :: Session (Cap * ((ST * ': s) ctx) s) r a -> Session (Cap * ctx (R * s)) r a #

weaken :: Session (Cap * ctx s) r a -> Session (Cap * ((ST * ': t) ctx) (Wk * s)) r a #

var :: Session (Cap * ((ST * ': s) ctx) s) r a -> Session (Cap * ((ST * ': s) ctx) (V *)) r a #

eps :: a -> Session (Cap * ctx (Eps *)) (Cap * ctx (Eps *)) a #

IxFunctor (Cap *) Session Source # 

Methods

fmap :: (a -> b) -> f j k a -> f j k b #

IxApplicative (Cap *) Session Source # 

Methods

pure :: a -> f i i a #

(<*>) :: f s r (a -> b) -> f r k a -> f s k b #

IxMonad (Cap *) Session Source # 

Methods

(>>=) :: m s t a -> (a -> m t k b) -> m s k b #

(>>) :: m s t a -> m t k b -> m s k b #

return :: a -> m i i a #

fail :: String -> m i i a #

IxMonadIO (Cap *) Session Source # 

Methods

liftIO :: IO a -> m s s a #

IxMonadReader (Cap *) (Maybe SessionInfo) Session Source # 

Methods

ask :: m s s Session #

local :: (Session -> Session) -> m s t a -> m s t a #

reader :: (Session -> a) -> m i i a #

data SessionInfo Source #

The SessionInfo data type tells us information about another Session. Namely, the Session that is in a session with the Session that this specific SessionInfo belongs to.

Constructors

SessionInfo 

Fields

Instances

IxMonadReader (Cap *) (Maybe SessionInfo) Session Source # 

Methods

ask :: m s s Session #

local :: (Session -> Session) -> m s t a -> m s t a #

reader :: (Session -> a) -> m i i a #

runSession :: Session s r a -> Maybe SessionInfo -> STTerm Process s r a Source #

Evaluates a session to a STTerm

Lifting

liftP :: Process a -> Session s s a Source #

Lifts a Process computation

liftST :: STTerm Process s r a -> Session s r a Source #

Lifts a STTerm computation

Spawning sessions

Call

callLocalSessionP :: (HasConstraint Serializable s, HasConstraint Serializable (Dual s)) => Session s r a -> Session (Dual s) r b -> Process (a, ProcessId) Source #

Calls a local session consisting of two dual Sessions.

Spawns a new local process for the second Session and runs the first Session on the current process.

Returns the result of the first Session and the ProcessId of the second Session.

callRemoteSessionP :: Serializable a => Static (SerializableDict a) -> NodeId -> Closure (SpawnSession a ()) -> Process (a, ProcessId) Source #

Calls a remote session consisting of two dual Sessions.

Spawns a remote process for the second Session and runs the first Session on the current process.

Returns the result of the frist Session and the ProcessId of the second Session.

The arguments of this function are described as follows:

  • Static (SerializableDict a): Describes how to serialize a value of type a
  • NodeId: The node identifier of the node that the second Session should be spawned to.
  • Closure (SpawnSession a ()): A closure of a wrapper over two dual Sessions.

Requires sessionRemoteTable

callRemoteSessionP' :: NodeId -> Closure (SpawnSession () ()) -> Process ProcessId Source #

Same as callRemoteSessionP, but we no longer need to provide a static serializable dictionary, because the result type of the first session is unit.

Requires sessionRemoteTable

Spawn

spawnLLSessionP :: (HasConstraint Serializable s, HasConstraint Serializable (Dual s)) => Session s r a -> Session (Dual s) r b -> Process (ProcessId, ProcessId) Source #

Spawns a local session.

Both Sessions are spawned locally.

Returns the ProcessId of both spawned processes.

spawnLRSessionP :: NodeId -> Closure (SpawnSession () ()) -> Process (ProcessId, ProcessId) Source #

Spawns one Session local and spawns another Session remote.

Returns the ProcessId of both spawned processes.

The arguments are described as follows:

  • NodeId: The node identifier of the node that the second Session should be spawned to.
  • Closure (SpawnSession () ()): A closure of a wrapper over two dual Sessions.

Requires sessionRemoteTable

spawnRRSessionP :: NodeId -> NodeId -> Closure (SpawnSession () ()) -> Process (ProcessId, ProcessId) Source #

Spawns a remote session. Both Session arguments are spawned remote.

Returns the ProcessId of both spawned processes.

The arguments are described as follows:

  • NodeId: The node identifier of the node that the first Session should be spawned to.
  • NodeId: The node identifier of the node that the second Session should be spawned to.
  • Closure (SpawnSession () ()): A closure of a wrapper over two dual Sessions.

Requires sessionRemoteTable

spawnRRSession :: NodeId -> NodeId -> Closure (SpawnSession () ()) -> Session s s (ProcessId, ProcessId) Source #

Sessioned version of SpawnRRSession

Requires sessionRemoteTable

Eval

evalSession :: forall s r a. HasConstraint Serializable s => Session s r a -> SessionInfo -> Process a Source #

This function unpacks a Session to a STTerm using a given SessionInfo.

It then evaluates the STTerm by mapping Cloud Haskell semantics to each constructor of STTerm.

The function relies on that there exists another session (on a different process) that is also being evaluated (using evalSession) and acts as the dual the session that function is now evaluating.

The underlying communication method is a session typed channel (STChannelT). There should be no interference from other processes, unless you go through the effort of sharing the send port.

evalSessionEq :: Session s s a -> Process a Source #

Similar to evalSession, except for that it does not evaluate session typed actions.

Only returns and lifted computations are evaluated. This also means that there does not need to be a dual session that is evaluated on a different process.

It also assumes that SessionInfo is not used. Use evalSessionEq' if this is not the case.

evalSessionEq' :: Session s s a -> SessionInfo -> Process a Source #

Same as evalSessionEq, but you may now provide a SessionInfo.

Closures

Encapsulation

data SpawnSession a b where Source #

Data type that encapsulates two sessions for the purpose of remotely spawning them

The session types of the sessions are existentially quantified, but we still ensure duality and constrain them properly, such that they can be passed to evalSession.

Constructors

SpawnSession :: (HasConstraintST Serializable s, HasConstraintST Serializable (DualST s), Typeable a, Typeable b) => Session (Cap '[] s) r a -> Session (Cap '[] (DualST s)) r b -> SpawnSession a b 

data SessionWrap a where Source #

Data type that encapsulates a single session performing no session typed action that can be remotely spawned.

We use this data type mostly for convenience in combination with evalSessionEq allowing us to avoid the Serializable constraint.

Constructors

SessionWrap :: Session s s a -> SessionWrap a 

RemoteTable

sessionRemoteTable :: RemoteTable -> RemoteTable Source #

RemoteTable that binds all in this module defined static functions to their corresponding evaluation functions.

Static and Closures

Singular

remoteSessionStatic :: Static (SerializableDict a -> Closure (SessionWrap a) -> Process a) Source #

Static function for remotely spawning a single session

When remotely spawning any session we must always pass it the ProcessId and NodeId of the spawning process.

We must pass a Closure of a SessionWrap instead of just a SessionWrap, because that would require serializing a SessionWrap which is not possible.

Furthermore, we must also pass a SerializableDict that shows how to serialize a value of type a.

remoteSessionClosure :: Static (SerializableDict a) -> Closure (SessionWrap a) -> Closure (Process a) Source #

Closure function for remotely spawning a single session

remoteSessionStatic' :: Static (Closure (SessionWrap ()) -> Process ()) Source #

Same as remoteSessionStatic, except that we do not need to provide a SerializableDict.

remoteSessionClosure' :: Closure (SessionWrap ()) -> Closure (Process ()) Source #

Same as remoteSessionClosure, except that we do not need to provide a SerializableDict.

SpawnChannel

spawnChannelStatic :: Static (SerializableDict a -> Closure (ReceivePort a -> SessionWrap ()) -> ReceivePort a -> Process ()) Source #

A static function specific to the lifted spawnChannel function that can be found in Control.Distributed.Session.Lifted

spawnChannelClosure :: Static (SerializableDict a) -> Closure (ReceivePort a -> SessionWrap ()) -> Closure (ReceivePort a -> Process ()) Source #

A closure specific to the lifted spawnChannel function that can be found in Control.Distributed.Session.Lifted

Local Remote Evaluation

evalLocalSession :: Typeable a => (ProcessId, NodeId, Closure (SpawnSession a ())) -> Process a Source #

Function that evalutes the first argument of a SpawnSession in a local manner.

It is local in that we do not create an accompanying closure.

remoteSpawnSessionStatic :: Static (SerializableDict a -> (ProcessId, NodeId, Closure (SpawnSession a ())) -> Process ()) Source #

Static function for remotely evaluating the second argument of a SpawnSession.

This function works dually to evalLocalSession.

remoteSpawnSessionClosure :: Static (SerializableDict a) -> (ProcessId, NodeId, Closure (SpawnSession a ())) -> Closure (Process ()) Source #

Closure for remotely evaluating the second argument of a SpawnSession

remoteSpawnSessionStatic' :: Static ((ProcessId, NodeId, Closure (SpawnSession () ())) -> Process ()) Source #

Same as remoteSpawnSessionStatic, except for that we do not need to provide a SerializableDict.

remoteSpawnSessionClosure' :: (ProcessId, NodeId, Closure (SpawnSession () ())) -> Closure (Process ()) Source #

Same as remoteSpawnSessionClosure, except for that we do not need to provide a SerializableDict.

Remote Remote Evaluation

rrSpawnSessionSendStatic :: Static ((ProcessId, NodeId, Closure (SpawnSession () ())) -> Process ()) Source #

Static function for remotely evaluating the second argument of a SpawnSession

This function is very similar to remoteSpawnSessionStatic'. The difference is that this function assumes that the other session was also remotely spawned.

Therefore we require an extra send of the ProcessId of the to be spawned process.

rrSpawnSessionSendClosure :: (ProcessId, NodeId, Closure (SpawnSession () ())) -> Closure (Process ()) Source #

Closure for remotely evaluating the second argument of a SpawnSession.

rrSpawnSessionExpectStatic :: Static ((NodeId, Closure (SpawnSession () ())) -> Process ()) Source #

Closure for remotely evaluating the first argument of a SpawnSession

This function acts dual to rrSpawnSessionSend and assumes that it will first receive a ProcessId.

rrSpawnSessionExpectClosure :: (NodeId, Closure (SpawnSession () ())) -> Closure (Process ()) Source #

Closure for remotely evaluating the first argument of a SpawnSession.

STChannel

Data types

data Message Source #

Basic message type that existentially quantifies the content of the message

Constructors

Serializable a => Message a 

Instances

data STSendPort (l :: Cap Type) Source #

Session typed send port as a wrapper over SendPort Message. It is parameterized with a capability/sessiontype.

Constructors

STSendPort (SendPort Message) 

Instances

STRec STSendPort Source # 

Methods

recChan :: STSendPort (Cap Type ctx (R Type s)) -> STSendPort (Cap Type ((ST Type ': s) ctx) s) Source #

wkChan :: STSendPort (Cap Type ((ST Type ': t) ctx) (Wk Type s)) -> STSendPort (Cap Type ctx s) Source #

varChan :: STSendPort (Cap Type ((ST Type ': s) ctx) (V Type)) -> STSendPort (Cap Type ((ST Type ': s) ctx) s) Source #

STSplit STSendPort Source # 

Methods

sel1Chan :: STSendPort (Cap Type ctx (Sel Type ((ST Type ': s) xs))) -> STSendPort (Cap Type ctx s) Source #

sel2Chan :: STSendPort (Cap Type ctx (Sel Type ((ST Type ': s) ((ST Type ': t) xs)))) -> STSendPort (Cap Type ctx (Sel Type ((ST Type ': t) xs))) Source #

off1Chan :: STSendPort (Cap Type ctx (Off Type ((ST Type ': s) xs))) -> STSendPort (Cap Type ctx s) Source #

off2Chan :: STSendPort (Cap Type ctx (Off Type ((ST Type ': s) ((ST Type ': t) xs)))) -> STSendPort (Cap Type ctx (Off Type ((ST Type ': t) xs))) Source #

data STReceivePort (l :: Cap Type) Source #

Session typed receive port as a wrapper over ReceivePort Message. It is parameterized with a capability/sessiontype.

Instances

STRec STReceivePort Source # 

Methods

recChan :: STReceivePort (Cap Type ctx (R Type s)) -> STReceivePort (Cap Type ((ST Type ': s) ctx) s) Source #

wkChan :: STReceivePort (Cap Type ((ST Type ': t) ctx) (Wk Type s)) -> STReceivePort (Cap Type ctx s) Source #

varChan :: STReceivePort (Cap Type ((ST Type ': s) ctx) (V Type)) -> STReceivePort (Cap Type ((ST Type ': s) ctx) s) Source #

STSplit STReceivePort Source # 

Methods

sel1Chan :: STReceivePort (Cap Type ctx (Sel Type ((ST Type ': s) xs))) -> STReceivePort (Cap Type ctx s) Source #

sel2Chan :: STReceivePort (Cap Type ctx (Sel Type ((ST Type ': s) ((ST Type ': t) xs)))) -> STReceivePort (Cap Type ctx (Sel Type ((ST Type ': t) xs))) Source #

off1Chan :: STReceivePort (Cap Type ctx (Off Type ((ST Type ': s) xs))) -> STReceivePort (Cap Type ctx s) Source #

off2Chan :: STReceivePort (Cap Type ctx (Off Type ((ST Type ': s) ((ST Type ': t) xs)))) -> STReceivePort (Cap Type ctx (Off Type ((ST Type ': t) xs))) Source #

Type synonyms

type STChan s = (STSendPort (RemoveRecv s), STReceivePort (RemoveSend s)) Source #

Type synonym for a session typed channel given a single session type

This removes recv session types from the given session type as it is passed to the send port type

Also removes send session types from the given session type as it is passed to the receive port type

type STChanBi s r = (STSendPort (RemoveRecv s), STReceivePort (RemoveSend r)) Source #

Same as STChan, but it is given a session type for the send port type and a separate session type for the receive port type

type UTChan = (SendPort Message, ReceivePort Message) Source #

Unsession typed typed channel

It is essentially just a typed channel that is parameterized with Message.

We can carry around this type in Session, but not a STChan.

Create

newSTChan :: Proxy s -> Process (STChan s) Source #

Creates a new session typed channel given a single session type

newSTChanBi :: Proxy s -> Proxy r -> Process (STChanBi s r) Source #

Creates a new session typed channel given separate session types for the send port and receive port

newUTChan :: Process UTChan Source #

Creates an unsession typed channel

toSTChan :: UTChan -> Proxy s -> STChan s Source #

Converts an unsession typed channel to a session typed channel

toSTChanBi :: UTChan -> Proxy s -> Proxy r -> STChanBi s r Source #

Converts an unsession typed channel to a session typed channel

sendProxy :: STSendPort s -> Proxy s Source #

Converts a session typed send port into a Proxy

recvProxy :: STReceivePort s -> Proxy s Source #

Converts a session typed receive port into a Proxy

Usage

sendSTChan :: Serializable a => STSendPort (Cap ctx (a :!> l)) -> a -> Process (STSendPort (Cap ctx l)) Source #

Sends a message using a session typed send port

recvSTChan :: Serializable a => STReceivePort (Cap ctx (a :?> l)) -> Process (a, STReceivePort (Cap ctx l)) Source #

Receives a message using a session typed receive port

class STSplit (m :: Cap Type -> Type) where Source #

Type class that defines combinators for branching on a session typed port

Minimal complete definition

sel1Chan, sel2Chan, off1Chan, off2Chan

Methods

sel1Chan :: m (Cap ctx (Sel (s ': xs))) -> m (Cap ctx s) Source #

select the first branch of a selection using the given port

sel2Chan :: m (Cap ctx (Sel (s ': (t ': xs)))) -> m (Cap ctx (Sel (t ': xs))) Source #

select the second branch of a selection using the given port

off1Chan :: m (Cap ctx (Off (s ': xs))) -> m (Cap ctx s) Source #

select the first branch of an offering using the given port

off2Chan :: m (Cap ctx (Off (s ': (t ': xs)))) -> m (Cap ctx (Off (t ': xs))) Source #

select the second branch of an offering using the given port

Instances

STSplit STReceivePort Source # 

Methods

sel1Chan :: STReceivePort (Cap Type ctx (Sel Type ((ST Type ': s) xs))) -> STReceivePort (Cap Type ctx s) Source #

sel2Chan :: STReceivePort (Cap Type ctx (Sel Type ((ST Type ': s) ((ST Type ': t) xs)))) -> STReceivePort (Cap Type ctx (Sel Type ((ST Type ': t) xs))) Source #

off1Chan :: STReceivePort (Cap Type ctx (Off Type ((ST Type ': s) xs))) -> STReceivePort (Cap Type ctx s) Source #

off2Chan :: STReceivePort (Cap Type ctx (Off Type ((ST Type ': s) ((ST Type ': t) xs)))) -> STReceivePort (Cap Type ctx (Off Type ((ST Type ': t) xs))) Source #

STSplit STSendPort Source # 

Methods

sel1Chan :: STSendPort (Cap Type ctx (Sel Type ((ST Type ': s) xs))) -> STSendPort (Cap Type ctx s) Source #

sel2Chan :: STSendPort (Cap Type ctx (Sel Type ((ST Type ': s) ((ST Type ': t) xs)))) -> STSendPort (Cap Type ctx (Sel Type ((ST Type ': t) xs))) Source #

off1Chan :: STSendPort (Cap Type ctx (Off Type ((ST Type ': s) xs))) -> STSendPort (Cap Type ctx s) Source #

off2Chan :: STSendPort (Cap Type ctx (Off Type ((ST Type ': s) ((ST Type ': t) xs)))) -> STSendPort (Cap Type ctx (Off Type ((ST Type ': t) xs))) Source #

class STRec (m :: Cap Type -> Type) where Source #

Type class for recursion on a session typed port

Minimal complete definition

recChan, wkChan, varChan

Methods

recChan :: m (Cap ctx (R s)) -> m (Cap (s ': ctx) s) Source #

wkChan :: m (Cap (t ': ctx) (Wk s)) -> m (Cap ctx s) Source #

varChan :: m (Cap (s ': ctx) V) -> m (Cap (s ': ctx) s) Source #

Instances

STRec STReceivePort Source # 

Methods

recChan :: STReceivePort (Cap Type ctx (R Type s)) -> STReceivePort (Cap Type ((ST Type ': s) ctx) s) Source #

wkChan :: STReceivePort (Cap Type ((ST Type ': t) ctx) (Wk Type s)) -> STReceivePort (Cap Type ctx s) Source #

varChan :: STReceivePort (Cap Type ((ST Type ': s) ctx) (V Type)) -> STReceivePort (Cap Type ((ST Type ': s) ctx) s) Source #

STRec STSendPort Source # 

Methods

recChan :: STSendPort (Cap Type ctx (R Type s)) -> STSendPort (Cap Type ((ST Type ': s) ctx) s) Source #

wkChan :: STSendPort (Cap Type ((ST Type ': t) ctx) (Wk Type s)) -> STSendPort (Cap Type ctx s) Source #

varChan :: STSendPort (Cap Type ((ST Type ': s) ctx) (V Type)) -> STSendPort (Cap Type ((ST Type ': s) ctx) s) Source #

Channel transformer

data STChannelT m (p :: Prod Type) (q :: Prod Type) a Source #

Indexed monad transformer that is indexed by two products of session types

This monad also acts as a state monad that whose state is defined by a session typed channel and dependent on the indexing of the monad.

Constructors

STChannelT 

Instances

Monad m => IxMonadT (Prod Type) STChannelT m Source # 

Methods

lift :: m a -> m m s s a #

Monad m => IxFunctor (Prod Type) (STChannelT m) Source # 

Methods

fmap :: (a -> b) -> f j k a -> f j k b #

Monad m => IxApplicative (Prod Type) (STChannelT m) Source # 

Methods

pure :: a -> f i i a #

(<*>) :: f s r (a -> b) -> f r k a -> f s k b #

Monad m => IxMonad (Prod Type) (STChannelT m) Source # 

Methods

(>>=) :: m s t a -> (a -> m t k b) -> m s k b #

(>>) :: m s t a -> m t k b -> m s k b #

return :: a -> m i i a #

fail :: String -> m i i a #

sendSTChanM :: Serializable a => a -> STChannelT Process (Cap ctx (a :!> l) :*: r) (Cap ctx l :*: r) () Source #

Send a message

Only the session type of the send port needs to be adjusted

recvSTChanM :: Serializable a => STChannelT Process (l :*: Cap ctx (a :?> r)) (l :*: Cap ctx r) a Source #

receive a message

Only the session type of the receive port needs to be adjusted

sel1ChanM :: STChannelT Process (Cap lctx (Sel (l ': ls)) :*: Cap rctx (Sel (r ': rs))) (Cap lctx l :*: Cap rctx r) () Source #

select the first branch of a selection

Both ports are now adjusted. This is similarly so for the remaining combinators.

sel2ChanM :: STChannelT Process (Cap lctx (Sel (s1 ': (t1 ': xs1))) :*: Cap rctx (Sel (s2 ': (t2 ': xs2)))) (Cap lctx (Sel (t1 ': xs1)) :*: Cap rctx (Sel (t2 ': xs2))) () Source #

select the second branch of a selection

off1ChanM :: STChannelT Process (Cap lctx (Off (l ': ls)) :*: Cap rctx (Off (r ': rs))) (Cap lctx l :*: Cap rctx r) () Source #

select the first branch of an offering

off2ChanM :: STChannelT Process (Cap lctx (Off (s1 ': (t1 ': xs1))) :*: Cap rctx (Off (s2 ': (t2 ': xs2)))) (Cap lctx (Off (t1 ': xs1)) :*: Cap rctx (Off (t2 ': xs2))) () Source #

select the second branch of an offering

recChanM :: STChannelT Process (Cap sctx (R s) :*: Cap rctx (R r)) (Cap (s ': sctx) s :*: Cap (r ': rctx) r) () Source #

delimit scope of recursion

wkChanM :: STChannelT Process (Cap (t ': sctx) (Wk s) :*: Cap (k ': rctx) (Wk r)) (Cap sctx s :*: Cap rctx r) () Source #

weaken scope of recursion

varChanM :: STChannelT Process (Cap (s ': sctx) V :*: Cap (r ': rctx) V) (Cap (s ': sctx) s :*: Cap (r ': rctx) r) () Source #

recursion variable (recurse here)

epsChanM :: STChannelT Process (Cap ctx Eps :*: Cap ctx Eps) (Cap ctx Eps :*: Cap ctx Eps) () Source #

ports are no longer usable

Lifted

utsend :: Serializable a => ProcessId -> a -> Session s s () Source #

Unsession typed send

usend :: Serializable a => ProcessId -> a -> Session s s () Source #

Unsafe send

sendChan :: Serializable a => SendPort a -> a -> Session s s () Source #

receiveWait :: [Match b] -> Session s s b Source #

handleMessage :: Serializable a => Message -> (a -> Session s s b) -> Session r r (Maybe b) Source #

handleMessage_ :: Serializable a => Message -> (a -> Session s s ()) -> Session r r () Source #

handleMessageP_ :: Serializable a => Message -> (a -> Process ()) -> Session s s () Source #

handleMessageIf :: Serializable a => Message -> (a -> Bool) -> (a -> Session s s b) -> Session r r (Maybe b) Source #

handleMessageIf_ :: Serializable a => Message -> (a -> Bool) -> (a -> Session s s ()) -> Session r r () Source #

handleMessageIfP :: Serializable a => Message -> (a -> Bool) -> (a -> Process b) -> Session s s (Maybe b) Source #

handleMessageIfP_ :: Serializable a => Message -> (a -> Bool) -> (a -> Process ()) -> Session s s () Source #

proxy :: Serializable a => ProcessId -> (a -> Session s s Bool) -> Session r r () Source #

proxyP :: Serializable a => ProcessId -> (a -> Process Bool) -> Session s s () Source #

die :: Serializable a => a -> Session s s b Source #

exit :: Serializable a => ProcessId -> a -> Session s s () Source #

catchExit :: (Show a, Serializable a) => Session s s b -> (ProcessId -> a -> Session r r b) -> Session t t b Source #

catchExitP :: (Show a, Serializable a) => Process b -> (ProcessId -> a -> Process b) -> Session s s b Source #

catchesExit :: Session s s b -> [ProcessId -> Message -> Session r r (Maybe b)] -> Session t t b Source #

unStatic :: Typeable a => Static a -> Session s s a Source #

say :: String -> Session s s () Source #

nsend :: Serializable a => String -> a -> Session s s () Source #

callLocal :: Session s s a -> Session s s a Source #