@@ -105,6 +105,7 @@ module Network.HTTP.Req
105 ( -- * Making a request
105 ( -- * Making a request
106 -- $making-a-request
106 -- $making-a-request
108 -- * Embedding requests into your monad
109 -- * Embedding requests into your monad
109 -- $embedding-requests
110 -- $embedding-requests
110 , MonadHttp (..)
111 , MonadHttp (..)
@@ -418,6 +419,13 @@ globalManager = unsafePerformIO $ do
418 newIORef manager
419 newIORef manager
419{-# NOINLINE globalManager #-}
420{-# NOINLINE globalManager #-}
422+-- | Perform an action using global implicit 'L.Manager' that the rest of
423+-- the library uses. This allows to reuse connections that the 'L.Manager'
426+withReqManager :: MonadIO m => (L.Manager -> m a) -> m a
427+withReqManager m = liftIO (readIORef globalManager) >>= m
421----------------------------------------------------------------------------
429----------------------------------------------------------------------------
422-- Embedding requests into your monad
430-- Embedding requests into your monad