@@ -323,40 +323,29 @@ spec = do
323instance MonadHttp IO where
323instance MonadHttp IO where
324 handleHttpException = throwIO
324 handleHttpException = throwIO
326−instance MonadHttp (ReaderT HttpConfig IO) where
327− handleHttpException = liftIO . throwIO
330----------------------------------------------------------------------------
326----------------------------------------------------------------------------
331-- Helpers
327-- Helpers
333-- | Run request with such settings that it does not signal error on adverse
329-- | Run request with such settings that it does not signal error on adverse
334-- response status codes.
330-- response status codes.
336−prepareForShit
332+prepareForShit :: Req a -> IO a
337− :: ReaderT HttpConfig IO a
339−prepareForShit m = runReaderT m def { httpConfigCheckResponse = noNoise }
333+prepareForShit = runReq def { httpConfigCheckResponse = noNoise }
341 noNoise _ _ = return ()
335 noNoise _ _ = return ()
343-- | Run request with such settings that it throws on any response.
337-- | Run request with such settings that it throws on any response.
345−blindlyThrowing
339+blindlyThrowing :: Req a -> IO a
346− :: ReaderT HttpConfig IO a
348−blindlyThrowing m = runReaderT m def { httpConfigCheckResponse = doit }
340+blindlyThrowing = runReq def { httpConfigCheckResponse = doit }
350 doit _ _ = error "Oops!"
342 doit _ _ = error "Oops!"
352-- | Run request with such settings that every retry increments the given
344-- | Run request with such settings that every retry increments the given
353-- @'IORef' 'Int'@.
345-- @'IORef' 'Int'@.
355−countingRetries
347+countingRetries :: IORef Int -> Req a -> IO a
357− -> ReaderT HttpConfig IO a
359−countingRetries nref m = runReaderT m def
348+countingRetries nref = runReq def
360 { httpConfigCheckResponse = noNoise
349 { httpConfigCheckResponse = noNoise
361 , httpConfigRetryPolicy = R.constantDelay 50000 <> R.limitRetries 5
350 , httpConfigRetryPolicy = R.constantDelay 50000 <> R.limitRetries 5
362 , httpConfigRetryJudge = judge }
351 , httpConfigRetryJudge = judge }