• Creates a retriable optical which consists three functions:

    • triable: An operation that may fail.
    • strategy: Failure control strategy, which decides the operation should retry or exit.
    • set: A function that stores B into S and produces T.
                          ok
    S -+--->[ triable ]-+-------> A
       |         ^      |
       |   retry |      | err
       |         |      V
       |       [ strategy ]
       |        |
       +--------|-------+
                | exit  |
                |       V
    T <---------+----[ set ]<- B
    

    Type Parameters

    • M

    Parameters

    • monad: Monad<M>

      A Monad instance for M.

    Returns (<I>(initialState) => (<E, T>(strategy) => (<S, A>(triable) => (<B>(set) => Optical<M, S, T, A, B>))))

    The retriable optical.

      • <I>(initialState): (<E, T>(strategy) => (<S, A>(triable) => (<B>(set) => Optical<M, S, T, A, B>)))
      • Type Parameters

        • I

        Parameters

        • initialState: I

        Returns (<E, T>(strategy) => (<S, A>(triable) => (<B>(set) => Optical<M, S, T, A, B>)))

          • <E, T>(strategy): (<S, A>(triable) => (<B>(set) => Optical<M, S, T, A, B>))
          • Type Parameters

            • E

            • T

            Parameters

            Returns (<S, A>(triable) => (<B>(set) => Optical<M, S, T, A, B>))

              • <S, A>(triable): (<B>(set) => Optical<M, S, T, A, B>)
              • Type Parameters

                • S

                • A

                Parameters

                Returns (<B>(set) => Optical<M, S, T, A, B>)

                  • <B>(set): Optical<M, S, T, A, B>
                  • Type Parameters

                    • B

                    Parameters

                    • set: ((data) => ((modified) => T))
                        • (data): ((modified) => T)
                        • Parameters

                          • data: S

                          Returns ((modified) => T)

                            • (modified): T
                            • Parameters

                              • modified: B

                              Returns T

                    Returns Optical<M, S, T, A, B>

Generated using TypeDoc