Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

traverse

import { traverse } from "https://github.gh-proxy.cn/raw.githubusercontent.com/baetheus/fun/main/pair.ts";

Traverse a pair using another algebraic structure's Applicable.

@example
import { traverse, pair } from "./pair.ts";
import { some, ApplicableOption, fromPredicate } from "./option.ts";
import { pipe } from "./fn.ts";

const traverseOption = traverse(ApplicableOption);
const startsWithB = fromPredicate(
  (name: string) => name.startsWith("B")
);

const result1 = pipe(
  pair("Brandon", 37),
  traverseOption(startsWithB),
); // { tag: "Some", value: ["Brandon", 37] }

const result2 = pipe(
  pair("Alice", 37),
  traverseOption(startsWithB),
); // { tag: "None" }
function traverse<V extends Kind>(A: Applicable<V>): <A, I, J, K, L, M>(favi: (a: A) => $<V, [I, J, K], [L], [M]>) => <B>(ua: Pair<A, B>) => $<V, [Pair<I, B>, J, K], [L], [M]>;
§
traverse<V extends Kind>(A: Applicable<V>): <A, I, J, K, L, M>(favi: (a: A) => $<V, [I, J, K], [L], [M]>) => <B>(ua: Pair<A, B>) => $<V, [Pair<I, B>, J, K], [L], [M]>
[src]

§Type Parameters

§
V extends Kind
[src]

§Parameters

§Return Type

§
<A, I, J, K, L, M>(favi: (a: A) => $<V, [I, J, K], [L], [M]>) => <B>(ua: Pair<A, B>) => $<V, [Pair<I, B>, J, K], [L], [M]>
[src]