retry 0.2.0.0 → 0.3.0.0
raw patch · 2 files changed
+12/−12 lines, 2 filesdep +lifted-basedep +monad-controldep +transformersdep −MonadCatchIO-transformersdep −mtlPVP ok
version bump matches the API change (PVP)
Dependencies added: lifted-base, monad-control, transformers
Dependencies removed: MonadCatchIO-transformers, mtl
API changes (from Hackage documentation)
- Control.Retry: recoverAll :: MonadCatchIO m => RetrySettings -> m a -> m a
+ Control.Retry: recoverAll :: (MonadIO m, MonadBaseControl IO m) => RetrySettings -> m a -> m a
- Control.Retry: recovering :: MonadCatchIO m => RetrySettings -> [Handler m Bool] -> m a -> m a
+ Control.Retry: recovering :: (MonadIO m, MonadBaseControl IO m) => RetrySettings -> [Handler m Bool] -> m a -> m a
Files
- retry.cabal +4/−3
- src/Control/Retry.hs +8/−9
retry.cabal view
@@ -14,7 +14,7 @@ case we should hang back for a bit and retry the query instead of simply raising an exception. -version: 0.2.0.0+version: 0.3.0.0 synopsis: Retry combinators for monadic actions that may fail license: BSD3 license-file: LICENSE@@ -29,8 +29,9 @@ exposed-modules: Control.Retry build-depends: base ==4.*, - MonadCatchIO-transformers >= 0.3,- mtl >= 0.2,+ monad-control,+ lifted-base,+ transformers, data-default hs-source-dirs: src default-language: Haskell2010
src/Control/Retry.hs view
@@ -3,6 +3,7 @@ {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE FlexibleContexts #-} ----------------------------------------------------------------------------- -- | -- Module : Control.Retry@@ -45,9 +46,9 @@ ------------------------------------------------------------------------------- import Control.Concurrent-import Control.Exception (SomeException)-import Control.Monad.CatchIO-import Control.Monad.Trans+import Control.Exception.Lifted+import Control.Monad.IO.Class+import Control.Monad.Trans.Control import Data.Default import Prelude hiding (catch) -------------------------------------------------------------------------------@@ -94,7 +95,7 @@ -- | Delay thread using flat delay flatDelay :: MonadIO m => RetrySettings -> t -> m ()-flatDelay set@RetrySettings{..} !n = liftIO (threadDelay $ delay set)+flatDelay set@RetrySettings{..} !_ = liftIO (threadDelay $ delay set) -- | Delay in micro seconds delay :: RetrySettings -> Int@@ -161,13 +162,13 @@ -- Running action -- Running action -- *** Exception: this is an error-recoverAll :: MonadCatchIO m+recoverAll :: (MonadIO m, MonadBaseControl IO m) => RetrySettings -> m a -> m a recoverAll set f = recovering set [h] f where- h = Handler $ \ (e :: SomeException) -> return True+ h = Handler $ \ (_ :: SomeException) -> return True -- | Perform 'threadDelay' for the nth retry for the given settings.@@ -180,7 +181,7 @@ -- | Run an action and recover from a raised exception by potentially -- retrying the action a number of times.-recovering :: forall m a. MonadCatchIO m+recovering :: forall m a. (MonadIO m, MonadBaseControl IO m) => RetrySettings -- ^ Just use 'def' faor default settings -> [Handler m Bool]@@ -230,5 +231,3 @@ -- f = putStrLn "Running action" >> throw AnotherException -- h1 = Handler $ \ (e :: TestException) -> return False -- h2 = Handler $ \ (e :: AnotherException) -> return True--