Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- newtype RequestHandler effs req resp = RequestHandler {
- unRequestHandler :: req -> Eff (NonDet ': effs) resp
- data RequestHandlerLogMsg
- tryHandler :: forall effs req resp. RequestHandler effs req resp -> [req] -> Eff effs (Maybe resp)
- tryHandler' :: forall f effs req resp. (Alternative f, Monad f) => RequestHandler effs req (f resp) -> [req] -> Eff effs (f resp)
- wrapHandler :: RequestHandler effs req resp -> RequestHandler effs (Request req) (Response resp)
- extract :: Alternative f => Prism' a b -> a -> f b
- maybeToHandler :: (req -> Maybe resp) -> RequestHandler effs req resp
- generalise :: forall effs req req' resp resp'. (req' -> Maybe req) -> (resp -> resp') -> RequestHandler effs req resp -> RequestHandler effs req' resp'
- handleAdjustUnbalancedTx :: forall effs. (Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs, Member NodeClientEffect effs) => RequestHandler effs UnbalancedTx UnbalancedTx
- handleOwnAddresses :: forall a effs. (Member WalletEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs a (NonEmpty CardanoAddress)
- handleSlotNotifications :: forall effs. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs) => RequestHandler effs Slot Slot
- handleCurrentNodeClientSlot :: forall effs a. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs a Slot
- handleCurrentChainIndexSlot :: forall effs a. (Member (LogObserve (LogMessage Text)) effs, Member ChainIndexQueryEffect effs) => RequestHandler effs a Slot
- handleTimeNotifications :: forall effs. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs) => RequestHandler effs POSIXTime POSIXTime
- handleCurrentTime :: forall effs a. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs a POSIXTime
- handleCurrentNodeClientTimeRange :: forall effs a. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs a (POSIXTime, POSIXTime)
- handleTimeToSlotConversions :: forall effs. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs POSIXTimeRange SlotRange
- handleUnbalancedTransactions :: forall effs. (Member WalletEffect effs, Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs) => RequestHandler effs UnbalancedTx (Either WalletAPIError CardanoTx)
- handlePendingTransactions :: forall effs. (Member WalletEffect effs, Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs) => RequestHandler effs CardanoTx (Either WalletAPIError CardanoTx)
- handleChainIndexQueries :: forall effs. (Member (LogObserve (LogMessage Text)) effs, Member ChainIndexQueryEffect effs) => RequestHandler effs ChainIndexQuery ChainIndexResponse
- handleOwnInstanceIdQueries :: forall effs a. (Member (LogObserve (LogMessage Text)) effs, Member (Reader ContractInstanceId) effs) => RequestHandler effs a ContractInstanceId
- handleYieldedUnbalancedTx :: forall effs. (Member WalletEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs UnbalancedTx ()
- handleGetParams :: forall effs. (Member (LogObserve (LogMessage Text)) effs, Member NodeClientEffect effs) => RequestHandler effs () Params
Documentation
newtype RequestHandler effs req resp Source #
Request handlers that can choose whether to handle an effect (using
Alternative
). This is useful if req
is a sum type.
RequestHandler | |
|
Instances
data RequestHandlerLogMsg Source #
SlotNoticationTargetVsCurrent Slot Slot | |
HandleTxFailed WalletAPIError | |
AdjustingUnbalancedTx [Lovelace] |
Instances
tryHandler :: forall effs req resp. RequestHandler effs req resp -> [req] -> Eff effs (Maybe resp) Source #
tryHandler' :: forall f effs req resp. (Alternative f, Monad f) => RequestHandler effs req (f resp) -> [req] -> Eff effs (f resp) Source #
wrapHandler :: RequestHandler effs req resp -> RequestHandler effs (Request req) (Response resp) Source #
extract :: Alternative f => Prism' a b -> a -> f b Source #
maybeToHandler :: (req -> Maybe resp) -> RequestHandler effs req resp Source #
generalise :: forall effs req req' resp resp'. (req' -> Maybe req) -> (resp -> resp') -> RequestHandler effs req resp -> RequestHandler effs req' resp' Source #
Generalise a request handler
handlers for common requests
handleAdjustUnbalancedTx :: forall effs. (Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs, Member NodeClientEffect effs) => RequestHandler effs UnbalancedTx UnbalancedTx Source #
handleOwnAddresses :: forall a effs. (Member WalletEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs a (NonEmpty CardanoAddress) Source #
handleSlotNotifications :: forall effs. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs) => RequestHandler effs Slot Slot Source #
handleCurrentNodeClientSlot :: forall effs a. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs a Slot Source #
handleCurrentChainIndexSlot :: forall effs a. (Member (LogObserve (LogMessage Text)) effs, Member ChainIndexQueryEffect effs) => RequestHandler effs a Slot Source #
handleTimeNotifications :: forall effs. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs) => RequestHandler effs POSIXTime POSIXTime Source #
handleCurrentTime :: forall effs a. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs a POSIXTime Source #
handleCurrentNodeClientTimeRange :: forall effs a. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs a (POSIXTime, POSIXTime) Source #
handleTimeToSlotConversions :: forall effs. (Member NodeClientEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs POSIXTimeRange SlotRange Source #
handleUnbalancedTransactions :: forall effs. (Member WalletEffect effs, Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs) => RequestHandler effs UnbalancedTx (Either WalletAPIError CardanoTx) Source #
handlePendingTransactions :: forall effs. (Member WalletEffect effs, Member (LogObserve (LogMessage Text)) effs, Member (LogMsg RequestHandlerLogMsg) effs) => RequestHandler effs CardanoTx (Either WalletAPIError CardanoTx) Source #
handleChainIndexQueries :: forall effs. (Member (LogObserve (LogMessage Text)) effs, Member ChainIndexQueryEffect effs) => RequestHandler effs ChainIndexQuery ChainIndexResponse Source #
handleOwnInstanceIdQueries :: forall effs a. (Member (LogObserve (LogMessage Text)) effs, Member (Reader ContractInstanceId) effs) => RequestHandler effs a ContractInstanceId Source #
handleYieldedUnbalancedTx :: forall effs. (Member WalletEffect effs, Member (LogObserve (LogMessage Text)) effs) => RequestHandler effs UnbalancedTx () Source #
handleGetParams :: forall effs. (Member (LogObserve (LogMessage Text)) effs, Member NodeClientEffect effs) => RequestHandler effs () Params Source #