sessiontypes-distributed-0.1.1: Session types distributed

Safe HaskellNone
LanguageHaskell2010

Control.Distributed.Session.Session

Contents

Description

This module defines the Session session typed indexed monad.

Synopsis

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