typed-protocols-examples-0.2.0.3: Examples and tests for the typed-protocols framework
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.TypedProtocol.PingPong.Type

Synopsis

Documentation

data PingPong where Source #

The ping/pong protocol and the states in its protocol state machine.

This protocol serves as a simple example of the typed protocols framework to help understand the framework and as a template for writing other protocols.

For a slightly more realistic example, see the request/response protocol Network.TypedProtocol.ResResp.Type.

This declares the protocol itself. It is used both as a type level tag for the protocol and as the kind of the types of the states in the protocol state machine. That is PingPong is a kind, and StIdle is a type of that kind.

If the protocol needs any type parameters (e.g. for thing that end up in the messages) then those type parameters go here. See the request/response protocol for an example. It is parametrised over the types of the request and response.

Constructors

StIdle :: PingPong 
StBusy :: PingPong 
StDone :: PingPong 

Instances

Instances details
Protocol PingPong Source # 
Instance details

Defined in Network.TypedProtocol.PingPong.Type

Associated Types

data Message PingPong st st' #

data ClientHasAgency st #

data ServerHasAgency st #

data NobodyHasAgency st #

Show (ClientHasAgency st) Source # 
Instance details

Defined in Network.TypedProtocol.PingPong.Type

Show (ServerHasAgency st) Source # 
Instance details

Defined in Network.TypedProtocol.PingPong.Type

Show (Message PingPong from to) Source # 
Instance details

Defined in Network.TypedProtocol.PingPong.Type

Methods

showsPrec :: Int -> Message PingPong from to -> ShowS #

show :: Message PingPong from to -> String #

showList :: [Message PingPong from to] -> ShowS #

data ClientHasAgency (st :: PingPong) Source # 
Instance details

Defined in Network.TypedProtocol.PingPong.Type

data Message PingPong (from :: PingPong) (to :: PingPong) Source # 
Instance details

Defined in Network.TypedProtocol.PingPong.Type

data NobodyHasAgency (st :: PingPong) Source # 
Instance details

Defined in Network.TypedProtocol.PingPong.Type

data ServerHasAgency (st :: PingPong) Source # 
Instance details

Defined in Network.TypedProtocol.PingPong.Type