import { fn_either } from "https://deno.land/x/fun@v2.0.0-alpha.6/mod.ts";
const { ap } = fn_either;
Given a FnEither returning a function A => I and a FnEither returning a value A, combine them into a FnEither returning an I.
Examples
Example 1
Example 1
import * as FE from "./fn_either.ts";
import { pipe } from "./fn.ts";
type Person = { name: string; age: number };
const person = (name: string) => (age: number): Person => ({ name, age });
const result = pipe(
FE.of(person),
FE.ap(FE.of("Brandon")),
FE.ap(FE.of(37)),
); // FnEither<[], never, Person>