collect
import { collect } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/foldable.ts";Collect all values from a Foldable structure using the provided Initializable.
@example
import { collect } from "./foldable.ts";
import * as A from "./array.ts";
import * as N from "./number.ts";
const numbers = [1, 2, 3, 4, 5];
const sum = collect(
A.FoldableArray,
N.InitializableNumberSum
)(numbers);
console.log(sum); // 15
function collect<U extends Kind, A>({ fold }: Foldable<U>, { combine, init }: Initializable<A>): <B = never, C = never, D = unknown, E = unknown>(ua: $<U, [A, B, C], [D], [E]>) => A;