import { fold } from "https://deno.land/x/fun@v2.0.0-alpha.6/async_either.ts";
Fold away the inner Either from the AsyncEither
leaving us with the
result of our computation in the form of a Async
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
import * as TE from "./async_either.ts";
import * as T from "./async.ts";
import { flow, identity } from "./fn.ts";
const hello = flow(
TE.fold(() => "World", identity),
T.map((name) => `Hello ${name}!`),
);
assertEquals(await hello(TE.right("Functional!"))(), "Hello Functional!!");
assertEquals(await hello(TE.left(Error))(), "Hello World!");