sessiontypes-distributed-0.1.0: Session types distributed

Safe HaskellNone
LanguageHaskell2010

Control.Distributed.Session.Interactive

Description

This module exposes two functions for interactively evaluation a session typed program

To run a session you must have two participating actors. In our context, the actors are session typed programs.

Using this module the user will act as one of the actors in the session by suppling values to a receive

and selecting a branch for offerings.

Synopsis

Documentation

interactive :: (HasConstraints '[Read, Show, Typeable] s, Show a) => Session s r a -> Process a Source #

For this function the user will act as the dual to the given session. User interaction is only required when the given program does a receive or an offer.

A possible interaction goes as follows:

prog = do
 send 5
 x <- recv
 offer (eps x) (eps "")

main = interactive prog
> Enter value of type String: "test"
> (L)eft or (R)ight: L
 "test"

interactiveStep :: (HasConstraints '[Read, Show, Typeable] s, Show a) => Session s r a -> Process (Maybe a) Source #

Different from interactive is that this function gives the user the choice to abort the session after each session typed action.

Furthermore, it also prints additional output describing which session typed action occurred.