UNPKG

retry-ts

Version:

Retry combinators for monadic actions that may fail

25 lines (24 loc) 721 B
/** * @since 0.1.4 */ import { ReaderTask } from 'fp-ts/lib/ReaderTask' import { RetryPolicy, RetryStatus } from './index' /** * Apply policy and delay by its amount if it results in a retry. * Returns updated status. * * @since 0.1.4 */ export declare const applyAndDelay: <R>(policy: RetryPolicy, status: RetryStatus) => ReaderTask<R, RetryStatus> /** * Retry combinator for actions that don't raise exceptions, but * signal in their type the outcome has failed. Examples are the * `Option`, `Either` and `EitherT` monads. * * @since 0.1.4 */ export declare function retrying<R, A>( policy: RetryPolicy, action: (status: RetryStatus) => ReaderTask<R, A>, check: (a: A) => boolean ): ReaderTask<R, A>