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/either.ts";

Traverse an Either with an Applicative. If the Either is Left, it's wrapped in the Applicative. If it's Right, the function is applied and the result is wrapped.

@example
import * as E from "./either.ts";
import * as A from "./array.ts";

const traverseArray = E.traverse(A.ApplicableArray);
const double = (n: number) => [n * 2];

const result1 = traverseArray(double)(E.right(21));
// [Right(42)]

const result2 = traverseArray(double)(E.left("error"));
// [Left("error")]
function traverse<V extends Kind>(A: Applicable<V> & Mappable<V> & Wrappable<V>): <A, I, J, K, L, M>(faui: (a: A) => $<V, [I, J, K], [L], [M]>) => <B>(ta: Either<B, A>) => $<V, [Either<B, I>, J, K], [L], [M]>;
§
traverse<V extends Kind>(A: Applicable<V> & Mappable<V> & Wrappable<V>): <A, I, J, K, L, M>(faui: (a: A) => $<V, [I, J, K], [L], [M]>) => <B>(ta: Either<B, A>) => $<V, [Either<B, I>, J, K], [L], [M]>
[src]

§Type Parameters

§
V extends Kind
[src]

§Parameters

§Return Type

§
<A, I, J, K, L, M>(faui: (a: A) => $<V, [I, J, K], [L], [M]>) => <B>(ta: Either<B, A>) => $<V, [Either<B, I>, J, K], [L], [M]>
[src]