-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | An Applicative Functor deferring actions to run in a batch later.
--
-- This provides the type Batching, an Applicative which defers
-- request-response exchanges of a fixed type, to be performed in a
-- single batch. This means you can write code that appears to issue
-- requests and immediately receive their responses, but process the
-- requests jointly all at once.
@package batching
@version 0.1.0.0
-- | An Applicative for deferring "requests" to handle them all in
-- bulk.
module Control.Batching
-- | The bulk request-response Applicative.
--
-- A value of type Batching rq rs a describes a computation that
-- gathers some number of rq request values, expects the same
-- number of rs response values, and ultimately returns an
-- a result value derived from the responses.
--
-- This can be used to apply an offline resource allocation algorithm to
-- code written as if allocation requests were satisfied incrementally.
--
-- This synergizes well with -XApplicativeDo, which allows using
-- do-notation for this type, as long as requests do not depend on
-- earlier responses.
data Batching rq rs a
-- | Issue one request and retrieve its response.
request :: rq -> Batching rq rs rs
-- | Issue a Traversable of requests and retrieve their responses.
batchRequest :: forall t rq rs. Traversable t => t rq -> Batching rq rs (t rs)
-- | Given an allocator function in any Functor, run a
-- Batching computation.
runBatching :: Functor f => (forall n. Vec n rq -> f (Vec n rs)) -> Batching rq rs a -> f a
-- | Like runBatching, but without a Functor (or implicitly
-- in Identity).
runBatching_ :: (forall n. Vec n rq -> Vec n rs) -> Batching rq rs a -> a
instance GHC.Base.Functor (Control.Batching.BulkCont rq rs)
instance GHC.Base.Applicative (Control.Batching.BulkCont rq rs)
instance GHC.Base.Functor (Control.Batching.Batching rq rs)
instance GHC.Base.Applicative (Control.Batching.Batching rq rs)