An extended Monad also supports the tailRecM operation.

Type Parameters

  • M

Hierarchy

Properties

apply: (<T, U>(fn) => ((t) => Instance<Apply1<M, U>>))

Type declaration

flatMap: (<T1, U1>(a) => ((t) => Instance<Apply1<M, U1>>))

Type declaration

map: (<T, U>(fn) => ((t) => Instance<Apply1<M, U>>))

Type declaration

pure: (<T>(t) => Instance<Apply1<M, T>>)

Type declaration

tailRecM: (<X, A>(stepper) => ((state) => Get1<M, X>))

Type declaration

    • <X, A>(stepper): ((state) => Get1<M, X>)
    • Executes a stepper while it returns a Continue<A>. This exits only if stepper returned a Break<A> and forwards it.

      Almost all of the MonadRec instances are implemented with a simple while loop because JavaScript runtime rarely optimizes a tail call.

      Type Parameters

      • X

      • A

      Parameters

      Returns ((state) => Get1<M, X>)

      The execution result.

        • (state): Get1<M, X>
        • Parameters

          • state: A

          Returns Get1<M, X>

Generated using TypeDoc