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

compose

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

Compose two FnEithers, passing the right value of the first into the second.

@example
import * as FE from "./fn_either.ts";
import { pipe } from "./fn.ts";

const isPositive = (n: number) => n > 0;
const isInteger = (n: number) => Number.isInteger(n);

const isPositiveInteger = pipe(
  FE.fromPredicate(isPositive),
  FE.compose(FE.fromPredicate(isInteger)),
);

const result1 = isPositiveInteger(0); // Left(0)
const result2 = isPositiveInteger(1); // Right(1)
const result3 = isPositiveInteger(1.1); // Left(1.1)
function compose<A, I, J>(second: FnEither<A, J, I>): <B, D>(first: FnEither<D, B, A>) => FnEither<D, B | J, I>;
§
compose<A, I, J>(second: FnEither<A, J, I>): <B, D>(first: FnEither<D, B, A>) => FnEither<D, B | J, I>
[src]

§Type Parameters

§Parameters

§
second: FnEither<A, J, I>
[src]

§Return Type

§
<B, D>(first: FnEither<D, B, A>) => FnEither<D, B | J, I>
[src]