Skip to main content
Module

x/fun/async_either.ts>join

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Go to Latest
function join
import { join } from "https://deno.land/x/fun@v.2.0.0-alpha.11/async_either.ts";

Flatten a AsyncEither wrapped in a AsyncEither

import { assertEquals } from "https://deno.land/std/testing/asserts.ts";
import * as TE from "./async_either.ts";
import * as E from "./either.ts";
import { pipe } from "./fn.ts";

const ta = pipe(
  TE.of(1),
  TE.map(n => TE.of(n*2)),
  TE.join,
  TE.chain(n => TE.of(n**2))
)

assertEquals(await ta(), E.right(4))