sessiontypes-0.1.2: Session types library

Safe HaskellSafe
LanguageHaskell2010

Control.SessionTypes.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 :: (MonadIO m, HasConstraints '[Read, Show, Typeable] s, Show a) => STTerm m s r a -> m a Source #

For this function tThe user will act as the dual to the given STTerm. 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 :: (MonadIO m, HasConstraints '[Read, Show, Typeable] s, Show a) => STTerm m s r a -> m (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.