Safe Haskell | None |
---|---|
Language | Haskell2010 |
A view of the transaction submission protocol from the point of view of the client.
This provides a view that uses less complex types and should be easier to use than the underlying typed protocol itself.
For execution, localTxSubmissionClientPeer
is provided for conversion
into the typed protocol.
Synopsis
- newtype LocalTxSubmissionClient tx reject (m :: Type -> Type) a = LocalTxSubmissionClient {
- runLocalTxSubmissionClient :: m (LocalTxClientStIdle tx reject m a)
- data LocalTxClientStIdle tx reject (m :: Type -> Type) a where
- SendMsgSubmitTx :: forall tx reject (m :: Type -> Type) a. tx -> (SubmitResult reject -> m (LocalTxClientStIdle tx reject m a)) -> LocalTxClientStIdle tx reject m a
- SendMsgDone :: forall a tx reject (m :: Type -> Type). a -> LocalTxClientStIdle tx reject m a
- data SubmitResult reason
- = SubmitSuccess
- | SubmitFail reason
- localTxSubmissionClientPeer :: forall tx reject (m :: Type -> Type) a. Monad m => LocalTxSubmissionClient tx reject m a -> Client (LocalTxSubmission tx reject) 'NonPipelined ('StIdle :: LocalTxSubmission tx reject) m a
- mapLocalTxSubmissionClient :: forall tx tx' reject reject' (m :: Type -> Type) a. Functor m => (tx -> tx') -> (reject' -> reject) -> LocalTxSubmissionClient tx reject m a -> LocalTxSubmissionClient tx' reject' m a
Protocol type for the client
The protocol states from the point of view of the client.
newtype LocalTxSubmissionClient tx reject (m :: Type -> Type) a Source #
LocalTxSubmissionClient | |
|
data LocalTxClientStIdle tx reject (m :: Type -> Type) a where Source #
The client side of the local transaction submission protocol.
The peer in the client role submits transactions to the peer in the server role.
SendMsgSubmitTx :: forall tx reject (m :: Type -> Type) a. tx -> (SubmitResult reject -> m (LocalTxClientStIdle tx reject m a)) -> LocalTxClientStIdle tx reject m a | The client submits a single transaction and waits a reply. The server replies to inform the client that it has either accepted the transaction or rejected it. In the rejection case a reason for the rejection is included. |
SendMsgDone :: forall a tx reject (m :: Type -> Type). a -> LocalTxClientStIdle tx reject m a | The client can terminate the protocol. |
The result from a transaction submission.
data SubmitResult reason Source #
Isomorphic with Maybe but with a name that better describes its purpose and usage.
SubmitSuccess | |
SubmitFail reason |
Instances
Functor SubmitResult Source # | |
Defined in Ouroboros.Network.Protocol.LocalTxSubmission.Type fmap :: (a -> b) -> SubmitResult a -> SubmitResult b # (<$) :: a -> SubmitResult b -> SubmitResult a # | |
Eq reason => Eq (SubmitResult reason) Source # | |
Defined in Ouroboros.Network.Protocol.LocalTxSubmission.Type (==) :: SubmitResult reason -> SubmitResult reason -> Bool # (/=) :: SubmitResult reason -> SubmitResult reason -> Bool # |
Execution as a typed protocol
localTxSubmissionClientPeer :: forall tx reject (m :: Type -> Type) a. Monad m => LocalTxSubmissionClient tx reject m a -> Client (LocalTxSubmission tx reject) 'NonPipelined ('StIdle :: LocalTxSubmission tx reject) m a Source #
A non-pipelined Peer
representing the LocalTxSubmissionClient
.
Utilities
mapLocalTxSubmissionClient :: forall tx tx' reject reject' (m :: Type -> Type) a. Functor m => (tx -> tx') -> (reject' -> reject) -> LocalTxSubmissionClient tx reject m a -> LocalTxSubmissionClient tx' reject' m a Source #
Transform a LocalTxSubmissionClient
by mapping over the tx and the
rejection errors.
Note the direction of the individual mapping functions corresponds to whether the types are used as protocol inputs or outputs.