typed-protocols-examples
Safe HaskellNone
LanguageHaskell2010

Network.TypedProtocol.Stateful.ReqResp.Type

Description

An RPC protocol which in which request type determines respond time. Unlike in the Type where req and resp types where statically defined, here the respond type is dynamically determined by the type of request.

Synopsis

Documentation

data ReqResp (req :: Type -> Type) where Source #

Constructors

StIdle :: forall (req :: Type -> Type). ReqResp req 
StBusy :: forall res (req :: Type -> Type). res -> ReqResp req 
StDone :: forall (req :: Type -> Type). ReqResp req 

Instances

Instances details
Protocol (ReqResp req) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

Associated Types

type StateToken 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

type StateToken = SReqResp :: ReqResp req -> Type
StateTokenI ('StDone :: ReqResp req) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

Methods

stateToken :: StateToken ('StDone :: ReqResp req) #

StateTokenI ('StIdle :: ReqResp req) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

Methods

stateToken :: StateToken ('StIdle :: ReqResp req) #

StateTokenI ('StBusy res2 :: ReqResp req) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

Methods

stateToken :: StateToken ('StBusy res2 :: ReqResp req) #

data Message (ReqResp req) (from :: ReqResp req) (to :: ReqResp req) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

data Message (ReqResp req) (from :: ReqResp req) (to :: ReqResp req) where
type StateToken Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

type StateToken = SReqResp :: ReqResp req -> Type
type StateAgency ('StDone :: ReqResp req) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

type StateAgency ('StIdle :: ReqResp req) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

type StateAgency ('StBusy _1 :: ReqResp req) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

type StateAgency ('StBusy _1 :: ReqResp req) = 'ServerAgency

data SReqResp (st :: ReqResp req) where Source #

Constructors

SingIdle :: forall {req :: Type -> Type}. SReqResp ('StIdle :: ReqResp req) 
SingBusy :: forall {res1} (res2 :: res1) (req :: Type -> Type). SReqResp ('StBusy res2 :: ReqResp req) 
SingDone :: forall {req :: Type -> Type}. SReqResp ('StDone :: ReqResp req) 

Instances

Instances details
Show (SReqResp st) Source # 
Instance details

Defined in Network.TypedProtocol.Stateful.ReqResp.Type

Methods

showsPrec :: Int -> SReqResp st -> ShowS #

show :: SReqResp st -> String #

showList :: [SReqResp st] -> ShowS #

data State (st :: ReqResp req) where Source #

Constructors

StateIdle :: forall {req :: Type -> Type}. State ('StIdle :: ReqResp req) 
StateBusy :: forall (req :: Type -> Type) result. Typeable result => req result -> State ('StBusy result :: ReqResp req) 
StateDone :: forall {req :: Type -> Type}. State ('StDone :: ReqResp req) 

data FileAPI result where Source #

An example RPC, e.g. the req type.

Constructors

ReadFile :: FilePath -> FileAPI [Char] 
WriteFile :: FilePath -> String -> FileAPI ()