module Hasura.Services.Network
( ProvidesNetwork (..),
)
where
import Hasura.Prelude
import Hasura.Tracing
import Network.HTTP.Client qualified as HTTP
class (Monad m) => ProvidesNetwork m where
askHTTPManager :: m HTTP.Manager
instance (ProvidesNetwork m) => ProvidesNetwork (ReaderT r m) where
askHTTPManager :: ReaderT r m Manager
askHTTPManager = m Manager -> ReaderT r m Manager
forall (m :: * -> *) a. Monad m => m a -> ReaderT r m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Manager
forall (m :: * -> *). ProvidesNetwork m => m Manager
askHTTPManager
instance (Monoid w, ProvidesNetwork m) => ProvidesNetwork (WriterT w m) where
askHTTPManager :: WriterT w m Manager
askHTTPManager = m Manager -> WriterT w m Manager
forall (m :: * -> *) a. Monad m => m a -> WriterT w m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Manager
forall (m :: * -> *). ProvidesNetwork m => m Manager
askHTTPManager
instance (ProvidesNetwork m) => ProvidesNetwork (StateT s m) where
askHTTPManager :: StateT s m Manager
askHTTPManager = m Manager -> StateT s m Manager
forall (m :: * -> *) a. Monad m => m a -> StateT s m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Manager
forall (m :: * -> *). ProvidesNetwork m => m Manager
askHTTPManager
instance (ProvidesNetwork m) => ProvidesNetwork (ExceptT e m) where
askHTTPManager :: ExceptT e m Manager
askHTTPManager = m Manager -> ExceptT e m Manager
forall (m :: * -> *) a. Monad m => m a -> ExceptT e m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Manager
forall (m :: * -> *). ProvidesNetwork m => m Manager
askHTTPManager
instance (ProvidesNetwork m) => ProvidesNetwork (TraceT m) where
askHTTPManager :: TraceT m Manager
askHTTPManager = m Manager -> TraceT m Manager
forall (m :: * -> *) a. Monad m => m a -> TraceT m a
forall (t :: (* -> *) -> * -> *) (m :: * -> *) a.
(MonadTrans t, Monad m) =>
m a -> t m a
lift m Manager
forall (m :: * -> *). ProvidesNetwork m => m Manager
askHTTPManager