packages feed

retry 0.7.6.3 → 0.7.7.0

raw patch · 3 files changed

+20/−1 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Control.Retry: natTransformRetryPolicy :: (forall a. m a -> n a) -> RetryPolicyM m -> RetryPolicyM n

Files

changelog.md view
@@ -1,3 +1,6 @@+0.7.7.0+* Add `natTransformRetryPolicy`+ 0.7.6.3 * Documentation fix on `recoverAll` 
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.7.6.3+version:             0.7.7.0 synopsis:            Retry combinators for monadic actions that may fail license:             BSD3 license-file:        LICENSE
src/Control/Retry.hs view
@@ -35,6 +35,7 @@       RetryPolicyM (..)     , RetryPolicy     , retryPolicy+    , natTransformRetryPolicy     , RetryStatus (..)     , defaultRetryStatus     , applyPolicy@@ -174,6 +175,21 @@       b' <- MaybeT $ b n       return $! max a' b' #endif+++-------------------------------------------------------------------------------+-- | Applies a natural transformation to a policy to run a RetryPolicy+-- meant for the monad @m@ in the monad @n@ provided a transformation+-- from @m@ to @n@ is available. A common case is if you have a pure+-- policy, @RetryPolicyM Identity@ and want to use it to govern an+-- @IO@ computation you could write:+--+-- @+--   purePolicyInIO :: RetryPolicyM Identity -> RetryPolicyM IO+--   purePolicyInIO = natTransformRetryPolicy (pure . runIdentity)+-- @+natTransformRetryPolicy :: (forall a. m a -> n a) -> RetryPolicyM m -> RetryPolicyM n+natTransformRetryPolicy f (RetryPolicyM p) = RetryPolicyM $ \stat -> f (p stat)   -------------------------------------------------------------------------------