BSD-3-Clause licensed by Ozgun Ataman
Maintained by [email protected]
This version can be pinned in stack with:retry-,2426

Module documentation for

README Build Status Coverage Status

retry - combinators for monadic actions that may fail


Monadic action combinators that add delayed-retry functionality, potentially with exponential-backoff, to arbitrary actions.

The main purpose of this package is to make it easy to work reliably with IO and similar actions that often fail. Common examples are database queries and large file uploads.


Please see haddocks for documentation.




Ozgun Ataman, Soostone Inc


Contributors, please list yourself here.

  • Mitsutoshi Aoe (@maoe)
  • John Wiegley
  • Michael Snoyman
  • Michael Xavier
  • Toralf Wittner
  • Marco Zocca (@ocramz)


  • Resolve warnings in test suite PR 83

  • Add UnliftIO.Retry PR 81

  • Use explicit import for lift which allows for mtl-2.3 compatibility PR 80

  • Add resumable retry/recover variants:
    • resumeRetrying
    • resumeRetryingDynamic
    • resumeRecovering
    • resumeRecoveringDynamic
    • resumeRecoverAll

  • Replace several uses of RetryPolicy type alias with RetryPolicyM m for better GHC 9 compat.

  • Set lower bound on base to >= 4.8

  • Loosen upper bounds

  • Add retryingDynamic and recoveringDynamic. PR 65

  • Update docs for default retry policy. PR 64

  • Loosen upper bounds

  • Remove dependency on data-default-class

  • Add natTransformRetryPolicy

  • Documentation fix on recoverAll

  • Loosen bounds on exceptions again.

  • Loosen bounds on exceptions.

  • Clarify the semantics of limitRetriesByDelay.
  • Add limitRetriesByCumulativeDelay

  • Improve haddocks for fullJitterBackoff.

  • Add Semigroup instance when the Semigroup class is available through base.

  • Loosen dependency upper bounds.


  • Add skipAsyncExceptions helper function

  • Loosen HUnit dependency for tests.

  • Loosen QuickCheck dependency for tests.


  • Widen transformers dependency


  • Widen ghc-prim dependency for GHC 8


  • Fix premature integer overflow error thanks to Mitsutoshi Aoe


  • Various documentation updates.
  • Add stepping combinator for manual retries.
  • Add applyPolicy and applyAndDelay
  • Add Read instance for RetryStatus
  • Fix logic bug in rsPreviousDelay in first retry

  • Officially drop support for GHC < 7.6 due to usage of Generics.


  • RetryPolicy has become RetryPolicyM, allowing for policy logic to consult the monad context.
  • RetryPolicyM now takes a RetryStatus value. Use the function rsIterNum to preserve existing behavior of RetryPolicy only receiving the number.
  • The monadic action now gets the RetryStatus on each try. Use const if you don’t need it.
  • recoverAll explicitly does not handle the standard async exceptions. Users are encouraged to do the same when using recovering, as catching async exceptions can be hazardous.
  • We no longer re-export (<>) from Monoid.
  • Utility functions simulatePolicy and simulatePolicyPP have been added which help predict how a policy will behave on each iteration.


  • Actions are now retried in the original masking state, while handlers continue to run in MaskedInterruptible (@maoe)
  • Added several tests confirming exception hierarchy semantics under recovering (@ozataman)


  • Mitsutoshi’s backoff work inspired a complete redo of the RetryPolicy interface, replacing it with a monoidal RetryPolicy. The result is a much thinner API that actually provides much more power to the end user.
  • Now using microseconds in all premade policies. PLEASE TAKE CARE WHEN UPGRADING. It was a bad idea to use miliseconds and deviate from norms in the first place.


  • Transitioned to using Edward Kmett’s exceptions package instead of monad-control. Use 0.3 series if you still need monad-control support.


Thanks to John Wiegley and Michael Snoyman for their contributions:

  • Now using monad-control instead of MonadCatchIO, which is widely agreed to be broken.
  • Now using transformers instead of mtl, which was a broader than needed dependency.