@mikuroxina/mini-fn
    Preparing search index...

    Type Alias CatPlusT<M, CTX>

    A combinator which contains a ctx and can be transformed it into another one by its methods.

    type CatPlusT<M, CTX> = {
        abort: () => CatPlusT<M, CTX>;
        addM: <const K extends PropertyKey, A>(
            key: K,
            value: Get1<M, A>,
        ) => CatPlusT<M, Record<K, A> & CTX>;
        addMWith: <const K extends PropertyKey, A>(
            key: K,
            fn: (ctx: CTX) => Get1<M, A>,
        ) => CatPlusT<M, Record<K, A> & CTX>;
        addWith: <const K extends PropertyKey, A>(
            key: K,
            fn: (ctx: CTX) => A,
        ) => CatPlusT<M, Record<K, A> & CTX>;
        alt: <K extends PropertyKey, T>(
            key: K,
            action: (cat: CatPlusT<M, CTX>) => Get1<M, T>,
        ) => CatPlusAltT<M, CTX, K, T>;
        assert: (cond: (ctx: CTX) => boolean) => CatPlusT<M, CTX>;
        ctx: Get1<M, CTX>;
        finish: <R>(fn: (ctx: CTX) => R) => Get1<M, R>;
        finishM: <R>(fn: (ctx: CTX) => Get1<M, R>) => Get1<M, R>;
        loop: <S>(
            initState: S,
            body: (state: S, ctx: CTX) => Get1<M, ControlFlow.ControlFlow<never[], S>>,
        ) => CatPlusT<M, CTX>;
        monadFail: TypeClass.MonadPlus.MonadPlus<M>;
        run: (computation: Get1<M, never[]>) => CatPlusT<M, CTX>;
        runWith: (computation: (ctx: CTX) => Get1<M, never[]>) => CatPlusT<M, CTX>;
        when: (
            cond: (ctx: CTX) => boolean,
            computation: (ctx: CTX) => Get1<M, never[]>,
        ) => CatPlusT<M, CTX>;
        while: (
            cond: (ctx: CTX) => Get1<M, boolean>,
            body: (ctx: CTX) => Get1<M, never[]>,
        ) => CatPlusT<M, CTX>;
    }

    Type Parameters

    • M

      HKT key applied to MonadPlus.

    • CTX

      Passing context type.

    Index

    Properties

    abort: () => CatPlusT<M, CTX>

    Aborts the execution and return early.

    Type Declaration

    addM: <const K extends PropertyKey, A>(
        key: K,
        value: Get1<M, A>,
    ) => CatPlusT<M, Record<K, A> & CTX>

    Binds a new value wrapped by the monad.

    Type Declaration

      • <const K extends PropertyKey, A>(
            key: K,
            value: Get1<M, A>,
        ): CatPlusT<M, Record<K, A> & CTX>
      • Type Parameters

        • const K extends PropertyKey
        • A

        Parameters

        • key: K

          The new property key for context

        • value: Get1<M, A>

          The wrapped value to bind.

        Returns CatPlusT<M, Record<K, A> & CTX>

        A new CatT containing the value at the key.

    addMWith: <const K extends PropertyKey, A>(
        key: K,
        fn: (ctx: CTX) => Get1<M, A>,
    ) => CatPlusT<M, Record<K, A> & CTX>

    Binds a new value wrapped by the monad, calculated from ctx by fn.

    Type Declaration

      • <const K extends PropertyKey, A>(
            key: K,
            fn: (ctx: CTX) => Get1<M, A>,
        ): CatPlusT<M, Record<K, A> & CTX>
      • Type Parameters

        • const K extends PropertyKey
        • A

        Parameters

        • key: K

          The new property key for context

        • fn: (ctx: CTX) => Get1<M, A>

          The calculation which returns the wrapped value.

        Returns CatPlusT<M, Record<K, A> & CTX>

        A new CatT containing the value at the key.

    addWith: <const K extends PropertyKey, A>(
        key: K,
        fn: (ctx: CTX) => A,
    ) => CatPlusT<M, Record<K, A> & CTX>

    Appends a new value calculated from ctx by fn.

    Type Declaration

      • <const K extends PropertyKey, A>(
            key: K,
            fn: (ctx: CTX) => A,
        ): CatPlusT<M, Record<K, A> & CTX>
      • Type Parameters

        • const K extends PropertyKey
        • A

        Parameters

        • key: K

          The new property key for context

        • fn: (ctx: CTX) => A

          The calculation.

        Returns CatPlusT<M, Record<K, A> & CTX>

        A new CatT containing the value at the key.

    alt: <K extends PropertyKey, T>(
        key: K,
        action: (cat: CatPlusT<M, CTX>) => Get1<M, T>,
    ) => CatPlusAltT<M, CTX, K, T>

    Starts an alternate branches combinator CatPlusAltT.

    Type Declaration

    assert: (cond: (ctx: CTX) => boolean) => CatPlusT<M, CTX>

    Asserts the condition is satisfied. Otherwise, the computation will exit.

    Type Declaration

      • (cond: (ctx: CTX) => boolean): CatPlusT<M, CTX>
      • Parameters

        • cond: (ctx: CTX) => boolean

          The predicate which should be satisfied.

        Returns CatPlusT<M, CTX>

        The exiting computation when cond returned false, or does nothing.

    ctx: Get1<M, CTX>

    Contained context. Altering an interior value must be abstained, or may occurs unsound behaviors.

    finish: <R>(fn: (ctx: CTX) => R) => Get1<M, R>

    Reduces the context into a value by fn.

    Type Declaration

      • <R>(fn: (ctx: CTX) => R): Get1<M, R>
      • Type Parameters

        • R

        Parameters

        • fn: (ctx: CTX) => R

          The finishing computation.

        Returns Get1<M, R>

        A reduced value.

    finishM: <R>(fn: (ctx: CTX) => Get1<M, R>) => Get1<M, R>

    Reduces the context into a value on M by fn.

    Type Declaration

      • <R>(fn: (ctx: CTX) => Get1<M, R>): Get1<M, R>
      • Type Parameters

        • R

        Parameters

        • fn: (ctx: CTX) => Get1<M, R>

          The finishing computation.

        Returns Get1<M, R>

        A reduced value on M.

    loop: <S>(
        initState: S,
        body: (state: S, ctx: CTX) => Get1<M, ControlFlow.ControlFlow<never[], S>>,
    ) => CatPlusT<M, CTX>

    Runs a looping computation while it returns Continue<S>.

    Type Declaration

    The MonadPlus instance for M.

    run: (computation: Get1<M, never[]>) => CatPlusT<M, CTX>

    Runs the computation.

    Type Declaration

      • (computation: Get1<M, never[]>): CatPlusT<M, CTX>
      • Parameters

        • computation: Get1<M, never[]>

          The computation to run.

        Returns CatPlusT<M, CTX>

        A new CatT with modified environment.

    runWith: (computation: (ctx: CTX) => Get1<M, never[]>) => CatPlusT<M, CTX>

    Runs the computation with the context.

    Type Declaration

      • (computation: (ctx: CTX) => Get1<M, never[]>): CatPlusT<M, CTX>
      • Parameters

        • computation: (ctx: CTX) => Get1<M, never[]>

          The computation to run.

        Returns CatPlusT<M, CTX>

        A new CatT with modified environment.

    when: (
        cond: (ctx: CTX) => boolean,
        computation: (ctx: CTX) => Get1<M, never[]>,
    ) => CatPlusT<M, CTX>

    Runs a computation if only cond is satisfied.

    Type Declaration

      • (
            cond: (ctx: CTX) => boolean,
            computation: (ctx: CTX) => Get1<M, never[]>,
        ): CatPlusT<M, CTX>
      • Parameters

        • cond: (ctx: CTX) => boolean

          A condition function.

        • computation: (ctx: CTX) => Get1<M, never[]>

          A monadic operation used only if cond returns true.

        Returns CatPlusT<M, CTX>

        A new CatT with modified environment.

    while: (
        cond: (ctx: CTX) => Get1<M, boolean>,
        body: (ctx: CTX) => Get1<M, never[]>,
    ) => CatPlusT<M, CTX>

    Runs a looping computation while cond returns true.

    Type Declaration

      • (
            cond: (ctx: CTX) => Get1<M, boolean>,
            body: (ctx: CTX) => Get1<M, never[]>,
        ): CatPlusT<M, CTX>
      • Parameters

        • cond: (ctx: CTX) => Get1<M, boolean>

          A function to decide to continue the loop.

        • body: (ctx: CTX) => Get1<M, never[]>

          A computation to run.

        Returns CatPlusT<M, CTX>

        A new CatT with modified environment.