This module is concerned with allowing you to describe a session type. A session type is treated as a table or 2D array, where each row represents a particular session type function which can refer, by index, to the other rows.
Basically, what you have here is the ability to describe a program at the type level.
Just look at Control.Concurrent.Session.Tests for examples
Documentation
Send :: t -> Send t | |
SendInt :: Send Int | |
SendBool :: Send Bool | |
SendChar :: Send Char | |
SendStr :: Send String | |
SendDouble :: Send Double |
SNonTerminal (Send t) | |
SNoJumpsBeyond (Send t) idx | |
Dual (Recv t) (Send t) | |
Dual (Send t) (Recv t) | |
OnlyOutgoing nxt nxt' => OnlyOutgoing (Cons (Send t) nxt) (Cons t nxt') |
Recv :: t -> Recv t | |
RecvInt :: Recv Int | |
RecvBool :: Recv Bool | |
RecvChar :: Recv Char | |
RecvStr :: Recv String | |
RecvDouble :: Recv Double |
SNonTerminal (Recv t) | |
SNoJumpsBeyond (Recv t) idx | |
Dual (Recv t) (Send t) | |
Dual (Send t) (Recv t) | |
OnlyOutgoing nxt nxt' => OnlyOutgoing (Cons (Recv t) nxt) nxt' |
Jump l |
class SListOfJumps lst Source
SListOfJumps Nil | |
(SListOfJumps nxt, TyNum val) => SListOfJumps (Cons (Cons (Jump val) Nil) nxt) |
class SListOfSessionTypes lstOfLists Source
SListOfSessionTypes Nil | |
(SValidSessionType val, SListOfSessionTypes nxt) => SListOfSessionTypes (Cons val nxt) |
class SNonTerminal a Source
SNonTerminal (Recv t) | |
SNonTerminal (Send t) |
class SValidSessionType lst Source
(SValidSessionType nxt, SNonTerminal val) => SValidSessionType (Cons val nxt) | |
STerminal a => SValidSessionType (Cons a Nil) |
(~>) :: (TyList nxt, SNonTerminal a, SValidSessionType nxt) => a -> nxt -> Cons a nxtSource
class SNoJumpsBeyond s idx Source
SNoJumpsBeyond Nil idx | |
SNoJumpsBeyond End idx | |
SNoJumpsBeyond lol idx => SNoJumpsBeyond (Offer lol) idx | |
SNoJumpsBeyond lol idx => SNoJumpsBeyond (Select lol) idx | |
SmallerThan l idx => SNoJumpsBeyond (Jump l) idx | |
SNoJumpsBeyond (Recv t) idx | |
SNoJumpsBeyond (Send t) idx | |
(SNoJumpsBeyond val idx, SNoJumpsBeyond nxt idx) => SNoJumpsBeyond (Cons val nxt) idx |
class SWellFormedConfig idxA idxB ss Source
(SListOfSessionTypes ss, ListLength ss len, SNoJumpsBeyond ss len, SmallerThan idxA len, Elem ss idxA st, ListLength st len', SmallerThan idxB len') => SWellFormedConfig idxA idxB ss |
testWellformed :: SWellFormedConfig idxA idxB ss => ss -> idxA -> idxB -> BoolSource
class OnlyOutgoing a b | a -> b whereSource
onlyOutgoing :: a -> bSource
OnlyOutgoing nxt nxt' => OnlyOutgoing (Cons (Recv t) nxt) nxt' | |
OnlyOutgoing (Cons (Offer jl) Nil) (Cons (Choice jl) Nil) | |
OnlyOutgoing (Cons (Select jl) Nil) (Cons (Choice jl) Nil) | |
OnlyOutgoing (Cons (Jump l) Nil) (Cons (Jump l) Nil) | |
OnlyOutgoing nxt nxt' => OnlyOutgoing (Cons (Send t) nxt) (Cons t nxt') | |
OnlyOutgoing (Cons End Nil) (Cons End Nil) |