Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype LocalStateQueryServer block point (query :: Type -> Type) (m :: Type -> Type) a = LocalStateQueryServer {
- runLocalStateQueryServer :: m (ServerStIdle block point query m a)
- data ServerStIdle block point (query :: Type -> Type) (m :: Type -> Type) a = ServerStIdle {
- recvMsgAcquire :: Target point -> m (ServerStAcquiring block point query m a)
- recvMsgDone :: m a
- data ServerStAcquiring block point (query :: Type -> Type) (m :: Type -> Type) a where
- SendMsgAcquired :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. ServerStAcquired block point query m a -> ServerStAcquiring block point query m a
- SendMsgFailure :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. AcquireFailure -> ServerStIdle block point query m a -> ServerStAcquiring block point query m a
- data ServerStAcquired block point (query :: Type -> Type) (m :: Type -> Type) a = ServerStAcquired {
- recvMsgQuery :: forall result. query result -> m (ServerStQuerying block point query m a result)
- recvMsgReAcquire :: Target point -> m (ServerStAcquiring block point query m a)
- recvMsgRelease :: m (ServerStIdle block point query m a)
- data ServerStQuerying block point (query :: Type -> Type) (m :: Type -> Type) a result where
- SendMsgResult :: forall result block point (query :: Type -> Type) (m :: Type -> Type) a. result -> ServerStAcquired block point query m a -> ServerStQuerying block point query m a result
- localStateQueryServerPeer :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. Monad m => LocalStateQueryServer block point query m a -> Server (LocalStateQuery block point query) ('StIdle :: LocalStateQuery block point query) (State :: LocalStateQuery block point query -> Type) m a
Protocol type for the server
The protocol states from the point of view of the server.
newtype LocalStateQueryServer block point (query :: Type -> Type) (m :: Type -> Type) a Source #
LocalStateQueryServer | |
|
data ServerStIdle block point (query :: Type -> Type) (m :: Type -> Type) a Source #
In the StIdle
protocol state, the server does not have agency. Instead
it is waiting for:
- a request to acquire a state
- a termination messge
It must be prepared to handle either.
ServerStIdle | |
|
data ServerStAcquiring block point (query :: Type -> Type) (m :: Type -> Type) a where Source #
In the StAcquiring
protocol state, the server has agency and must send
either:
- acquired
- failure to acquire
SendMsgAcquired :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. ServerStAcquired block point query m a -> ServerStAcquiring block point query m a | |
SendMsgFailure :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. AcquireFailure -> ServerStIdle block point query m a -> ServerStAcquiring block point query m a |
data ServerStAcquired block point (query :: Type -> Type) (m :: Type -> Type) a Source #
In the StAcquired
protocol state, the server does not have agency.
Instead it is waiting for:
- a query
- a request to (re)acquire another state
- a release of the current state
It must be prepared to handle either.
ServerStAcquired | |
|
data ServerStQuerying block point (query :: Type -> Type) (m :: Type -> Type) a result where Source #
In the StQuerying
protocol state, the server has agency and must send:
- a result
SendMsgResult :: forall result block point (query :: Type -> Type) (m :: Type -> Type) a. result -> ServerStAcquired block point query m a -> ServerStQuerying block point query m a result |
Execution as a typed protocol
localStateQueryServerPeer :: forall block point (query :: Type -> Type) (m :: Type -> Type) a. Monad m => LocalStateQueryServer block point query m a -> Server (LocalStateQuery block point query) ('StIdle :: LocalStateQuery block point query) (State :: LocalStateQuery block point query -> Type) m a Source #
Interpret a LocalStateQueryServer
action sequence as a Peer
on the server
side of the LocalStateQuery
protocol.