on master help sign in
Derive ‘MonadThrow’, ‘MonadCatch’, and ‘MonadMask’ for ‘Req’
commit8c7a8a8dc13a1bf57b832ad6ab19ded0c13e3251 authorMark Karpov <markkarpov92@gmail.com> dateSat 17 Oct 2020, 17:24 (6 years ago) parent7ab742a
2 files changed+13−1
CHANGELOG.md+2 Network/HTTP/Req.hs+11−1
CHANGELOG.md+2
@@ -3,6 +3,8 @@
33* Added `reqCb`, a function that allows you to modify the `Request` object
44 but otherwise performs the requst for you.
55
6+* Derived `MonadThrow`, `MonadCatch`, and `MonadMask` for the `Req` monad.
7+
68## Req 3.6.0
79
810* Added the `httpConfigBodyPreviewLength` configuration parameter to
Network/HTTP/Req.hs+11−1
@@ -14,6 +14,7 @@
1414{-# LANGUAGE RecordWildCards #-}
1515{-# LANGUAGE RoleAnnotations #-}
1616{-# LANGUAGE ScopedTypeVariables #-}
17+{-# LANGUAGE StandaloneDeriving #-}
1718{-# LANGUAGE TemplateHaskellQuotes #-}
1819{-# LANGUAGE TypeFamilies #-}
1920{-# LANGUAGE UndecidableInstances #-}
@@ -236,7 +237,7 @@ import Control.Applicative
236237import Control.Arrow (first, second)
237238import Control.Exception hiding (Handler (..), TypeError)
238239import Control.Monad.Base
239−import Control.Monad.Catch (Handler (..))
240+import Control.Monad.Catch (Handler (..), MonadCatch, MonadMask, MonadThrow)
240241import Control.Monad.IO.Class
241242import Control.Monad.IO.Unlift
242243import Control.Monad.Reader
@@ -776,6 +777,15 @@ newtype Req a = Req (ReaderT HttpConfig IO a)
776777 MonadUnliftIO
777778 )
778779
780+-- | @since 3.7.0
781+deriving instance MonadThrow Req
782+
783+-- | @since 3.7.0
784+deriving instance MonadCatch Req
785+
786+-- | @since 3.7.0
787+deriving instance MonadMask Req
788+
779789instance MonadBase IO Req where
780790 liftBase = liftIO
781791