@@ -220,7 +220,21 @@ import Control.Monad.Catch (Handler (..), MonadCatch, MonadMask, MonadThrow)
220import Control.Monad.IO.Class
220import Control.Monad.IO.Class
221import Control.Monad.IO.Unlift
221import Control.Monad.IO.Unlift
222import Control.Monad.Reader
222import Control.Monad.Reader
223+import Control.Monad.Trans.Accum (AccumT)
224+import Control.Monad.Trans.Cont (ContT)
223import Control.Monad.Trans.Control
225import Control.Monad.Trans.Control
226+import Control.Monad.Trans.Except (ExceptT)
227+import Control.Monad.Trans.Identity (IdentityT)
228+import Control.Monad.Trans.Maybe (MaybeT)
229+import qualified Control.Monad.Trans.RWS.CPS as RWS.CPS
230+import qualified Control.Monad.Trans.RWS.Lazy as RWS.Lazy
231+import qualified Control.Monad.Trans.RWS.Strict as RWS.Strict
232+import Control.Monad.Trans.Select (SelectT)
233+import qualified Control.Monad.Trans.State.Lazy as State.Lazy
234+import qualified Control.Monad.Trans.State.Strict as State.Strict
235+import qualified Control.Monad.Trans.Writer.CPS as Writer.CPS
236+import qualified Control.Monad.Trans.Writer.Lazy as Writer.Lazy
237+import qualified Control.Monad.Trans.Writer.Strict as Writer.Strict
224import Control.Retry
238import Control.Retry
225import Data.Aeson (FromJSON (..), ToJSON (..))
239import Data.Aeson (FromJSON (..), ToJSON (..))
226import qualified Data.Aeson as A
240import qualified Data.Aeson as A
@@ -787,6 +801,81 @@ instance MonadHttp Req where
787 handleHttpException = Req . lift . throwIO
801 handleHttpException = Req . lift . throwIO
788 getHttpConfig = Req ask
802 getHttpConfig = Req ask
805+instance (MonadHttp m, Monoid w) => MonadHttp (AccumT w m) where
806+ handleHttpException = lift . handleHttpException
807+ getHttpConfig = lift getHttpConfig
810+instance MonadHttp m => MonadHttp (ContT r m) where
811+ handleHttpException = lift . handleHttpException
812+ getHttpConfig = lift getHttpConfig
815+instance MonadHttp m => MonadHttp (ExceptT e m) where
816+ handleHttpException = lift . handleHttpException
817+ getHttpConfig = lift getHttpConfig
820+instance MonadHttp m => MonadHttp (IdentityT m) where
821+ handleHttpException = lift . handleHttpException
822+ getHttpConfig = lift getHttpConfig
825+instance MonadHttp m => MonadHttp (MaybeT m) where
826+ handleHttpException = lift . handleHttpException
827+ getHttpConfig = lift getHttpConfig
830+instance MonadHttp m => MonadHttp (ReaderT r m) where
831+ handleHttpException = lift . handleHttpException
832+ getHttpConfig = lift getHttpConfig
835+instance (MonadHttp m, Monoid w) => MonadHttp (RWS.CPS.RWST r w s m) where
836+ handleHttpException = lift . handleHttpException
837+ getHttpConfig = lift getHttpConfig
840+instance (MonadHttp m, Monoid w) => MonadHttp (RWS.Lazy.RWST r w s m) where
841+ handleHttpException = lift . handleHttpException
842+ getHttpConfig = lift getHttpConfig
845+instance (MonadHttp m, Monoid w) => MonadHttp (RWS.Strict.RWST r w s m) where
846+ handleHttpException = lift . handleHttpException
847+ getHttpConfig = lift getHttpConfig
850+instance MonadHttp m => MonadHttp (SelectT r m) where
851+ handleHttpException = lift . handleHttpException
852+ getHttpConfig = lift getHttpConfig
855+instance MonadHttp m => MonadHttp (State.Lazy.StateT s m) where
856+ handleHttpException = lift . handleHttpException
857+ getHttpConfig = lift getHttpConfig
860+instance MonadHttp m => MonadHttp (State.Strict.StateT s m) where
861+ handleHttpException = lift . handleHttpException
862+ getHttpConfig = lift getHttpConfig
865+instance (MonadHttp m, Monoid w) => MonadHttp (Writer.CPS.WriterT w m) where
866+ handleHttpException = lift . handleHttpException
867+ getHttpConfig = lift getHttpConfig
870+instance (MonadHttp m, Monoid w) => MonadHttp (Writer.Lazy.WriterT w m) where
871+ handleHttpException = lift . handleHttpException
872+ getHttpConfig = lift getHttpConfig
875+instance (MonadHttp m, Monoid w) => MonadHttp (Writer.Strict.WriterT w m) where
876+ handleHttpException = lift . handleHttpException
877+ getHttpConfig = lift getHttpConfig
790-- | Run a computation in the 'Req' monad with the given 'HttpConfig'. In
879-- | Run a computation in the 'Req' monad with the given 'HttpConfig'. In
791-- the case of an exceptional situation an 'HttpException' will be thrown.
880-- the case of an exceptional situation an 'HttpException' will be thrown.