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

dimap

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

Map over the input of a FnEither contravariantly and the right result of a FnEither covariantly.

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

// This has type FnEither<[Date], never, string>
const computation = pipe(
  FE.id<number>(),
  FE.dimap(
    (d: Date) => d.valueOf(),
    String,
  ),
);

const result = computation(new Date(0)); // Right('0')
function dimap<A, I, L, D>(fld: (l: L) => D, fai: (a: A) => I): <B>(ua: FnEither<D, B, A>) => FnEither<L, B, I>;
§
dimap<A, I, L, D>(fld: (l: L) => D, fai: (a: A) => I): <B>(ua: FnEither<D, B, A>) => FnEither<L, B, I>
[src]

§Parameters

§
fld: (l: L) => D
[src]
§
fai: (a: A) => I
[src]

§Return Type

§
<B>(ua: FnEither<D, B, A>) => FnEither<L, B, I>
[src]