Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype LocalStateQueryClient block point (query :: Type -> Type) (m :: Type -> Type) a = LocalStateQueryClient {
- runLocalStateQueryClient :: m (ClientStIdle block point query m a)
- data ClientStIdle block point (query :: Type -> Type) (m :: Type -> Type) a where
- SendMsgAcquire :: forall point block (query :: Type -> Type) (m :: Type -> Type) a. Target point -> ClientStAcquiring block point query m a -> ClientStIdle block point query m a
- SendMsgDone :: forall a block point (query :: Type -> Type) (m :: Type -> Type). a -> ClientStIdle block point query m a
- data ClientStAcquiring block point (query :: Type -> Type) (m :: Type -> Type) a = ClientStAcquiring {
- recvMsgAcquired :: m (ClientStAcquired block point query m a)
- recvMsgFailure :: AcquireFailure -> m (ClientStIdle block point query m a)
- data ClientStAcquired block point (query :: Type -> Type) (m :: Type -> Type) a where
- SendMsgQuery :: forall (query :: Type -> Type) result block point (m :: Type -> Type) a. query result -> ClientStQuerying block point query m a result -> ClientStAcquired block point query m a
- SendMsgReAcquire :: forall point block (query :: Type -> Type) (m :: Type -> Type) a. Target point -> ClientStAcquiring block point query m a -> ClientStAcquired block point query m a
- SendMsgRelease :: forall (m :: Type -> Type) block point (query :: Type -> Type) a. m (ClientStIdle block point query m a) -> ClientStAcquired block point query m a
- data ClientStQuerying block point (query :: Type -> Type) (m :: Type -> Type) a result = ClientStQuerying {
- recvMsgResult :: result -> m (ClientStAcquired block point query m a)
- localStateQueryClientPeer :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. Monad m => LocalStateQueryClient block point query m a -> Client (LocalStateQuery block point query) ('StIdle :: LocalStateQuery block point query) (State :: LocalStateQuery block point query -> Type) m a
- mapLocalStateQueryClient :: forall block block' point point' query query' (m :: Type -> Type) a. Functor m => (point -> point') -> (forall result. query result -> Some query') -> (forall result result'. query result -> query' result' -> result' -> result) -> LocalStateQueryClient block point query m a -> LocalStateQueryClient block' point' query' m a
- data Some (f :: k -> Type) where
Protocol type for the client
The protocol states from the point of view of the client.
newtype LocalStateQueryClient block point (query :: Type -> Type) (m :: Type -> Type) a Source #
LocalStateQueryClient | |
|
data ClientStIdle block point (query :: Type -> Type) (m :: Type -> Type) a where Source #
In the StIdle
protocol state, the client has agency and must send:
- a request to acquire a state
- a termination messge
SendMsgAcquire :: forall point block (query :: Type -> Type) (m :: Type -> Type) a. Target point -> ClientStAcquiring block point query m a -> ClientStIdle block point query m a | |
SendMsgDone :: forall a block point (query :: Type -> Type) (m :: Type -> Type). a -> ClientStIdle block point query m a |
data ClientStAcquiring block point (query :: Type -> Type) (m :: Type -> Type) a Source #
In the StAcquiring
protocol state, the client does not have agency.
Instead it is waiting for:
- acquired
- failure to acquire
It must be prepared to handle either.
ClientStAcquiring | |
|
data ClientStAcquired block point (query :: Type -> Type) (m :: Type -> Type) a where Source #
In the StAcquired
protocol state, the client has agency and must send:
- a query
- a request to (re)acquire another state
- a release of the current state
SendMsgQuery :: forall (query :: Type -> Type) result block point (m :: Type -> Type) a. query result -> ClientStQuerying block point query m a result -> ClientStAcquired block point query m a | |
SendMsgReAcquire :: forall point block (query :: Type -> Type) (m :: Type -> Type) a. Target point -> ClientStAcquiring block point query m a -> ClientStAcquired block point query m a | |
SendMsgRelease :: forall (m :: Type -> Type) block point (query :: Type -> Type) a. m (ClientStIdle block point query m a) -> ClientStAcquired block point query m a |
data ClientStQuerying block point (query :: Type -> Type) (m :: Type -> Type) a result Source #
In the StQuerying
protocol state, the client does not have agency.
Instead it is waiting for:
- a result
ClientStQuerying | |
|
Execution as a typed protocol
localStateQueryClientPeer :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. Monad m => LocalStateQueryClient block point query m a -> Client (LocalStateQuery block point query) ('StIdle :: LocalStateQuery block point query) (State :: LocalStateQuery block point query -> Type) m a Source #
Interpret a LocalStateQueryClient
action sequence as a Peer
on the
client side of the LocalStateQuery
protocol.
Utilities
mapLocalStateQueryClient :: forall block block' point point' query query' (m :: Type -> Type) a. Functor m => (point -> point') -> (forall result. query result -> Some query') -> (forall result result'. query result -> query' result' -> result' -> result) -> LocalStateQueryClient block point query m a -> LocalStateQueryClient block' point' query' m a Source #
Transform a LocalStateQueryClient
by mapping over the query and query
result values.
Note the direction of the individual mapping functions corresponds to whether the types are used as protocol inputs or outputs.