Maps an inner value of Cat into another Cat by applying a function. It is useful to lift a subroutine with Cat.
Cat
A function which maps from T to Cat<U>.
T
Cat<U>
A lifted function which maps from Cat<T> to Cat<U>.
Cat<T>
const sub = (num: number): Cat<string> => cat(num).feed((x) => x.toString());const actual = flatMap(sub)(cat(6)).value;expect(actual).toStrictEqual("6"); Copy
const sub = (num: number): Cat<string> => cat(num).feed((x) => x.toString());const actual = flatMap(sub)(cat(6)).value;expect(actual).toStrictEqual("6");
Maps an inner value of
Catinto anotherCatby applying a function. It is useful to lift a subroutine withCat.