Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- newtype LocalStateQueryServer block point (query ∷ Type → Type) m a = LocalStateQueryServer {
- runLocalStateQueryServer ∷ m (ServerStIdle block point query m a)
- data ServerStIdle block point query m a = ServerStIdle {
- recvMsgAcquire ∷ Target point → m (ServerStAcquiring block point query m a)
- recvMsgDone ∷ m a
- data ServerStAcquiring block point query m a where
- SendMsgAcquired ∷ ServerStAcquired block point query m a → ServerStAcquiring block point query m a
- SendMsgFailure ∷ AcquireFailure → ServerStIdle block point query m a → ServerStAcquiring block point query m a
- data ServerStAcquired block point query m a = ServerStAcquired {
- recvMsgQuery ∷ ∀ 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 m a result where
- SendMsgResult ∷ result → ServerStAcquired block point query m a → ServerStQuerying block point query m a result
- localStateQueryServerPeer ∷ ∀ block point (query ∷ Type → Type) m a. Monad m ⇒ LocalStateQueryServer block point query m a → Peer (LocalStateQuery block point query) AsServer StIdle 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 a Source #
LocalStateQueryServer | |
|
data ServerStIdle block point query m 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 m a where Source #
In the StAcquiring
protocol state, the server has agency and must send
either:
- acquired
- failure to acquire
SendMsgAcquired ∷ ServerStAcquired block point query m a → ServerStAcquiring block point query m a | |
SendMsgFailure ∷ AcquireFailure → ServerStIdle block point query m a → ServerStAcquiring block point query m a |
data ServerStAcquired block point query m 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 m a result where Source #
In the StQuerying
protocol state, the server has agency and must send:
- a result
SendMsgResult ∷ result → ServerStAcquired block point query m a → ServerStQuerying block point query m a result |
Execution as a typed protocol
localStateQueryServerPeer ∷ ∀ block point (query ∷ Type → Type) m a. Monad m ⇒ LocalStateQueryServer block point query m a → Peer (LocalStateQuery block point query) AsServer StIdle m a Source #
Interpret a LocalStateQueryServer
action sequence as a Peer
on the server
side of the LocalStateQuery
protocol.