Skip to main content
Module

x/fun/mod.ts>pair.swap

A collection of algebraic data types, lenses, and schemables based on a light weight higher kinded type implementation. Written for deno.
Latest
function pair.swap
import { pair } from "https://deno.land/x/fun@v2.0.0/mod.ts";
const { swap } = pair;

Creates a new Pair with the first and second values swapped.

Examples

Example 1

import * as P from "./pair.ts";
import { pipe } from "./fn.ts";

const shouldBe2 = pipe(
  P.pair(1, 2),
  P.swap,
  P.first
); // 2

Parameters

unnamed 0: Pair<A, B>