• Maps an inner value of Cat into another Cat by applying a function. It is useful to lift a subroutine with Cat.

    Type Parameters

    • T

    • U

    Parameters

    • fn: ((t) => Cat<U>)

      A function which maps from T to Cat<U>.

        • (t): Cat<U>
        • Parameters

          • t: T

          Returns Cat<U>

    Returns ((c) => Cat<U>)

    A lifted function which maps from Cat<T> to Cat<U>.

    Examples

    import { Cat, cat, flatMap } from "./cat.ts";
    import { assertEquals } from "../deps.ts";

    const sub = (num: number): Cat<string> =>
    cat(num).feed((x) => x.toString());
    const actual = flatMap(sub)(cat(6)).value;
    assertEquals(actual, "6");

Generated using TypeDoc