import * as E from "../../Either"; import { bimapEither, bimapEither_ } from "./bifunctor"; import type { XRef } from "./model"; /** * Transforms the `get` value of the `XRef` with the specified fallible * function. */ export const mapEither: ( f: (_: B) => E.Either ) => (_: XRef) => XRef = (f) => bimapEither((a) => E.right(a), f); /** * Transforms the `get` value of the `XRef` with the specified fallible * function. */ export const mapEither_: ( _: XRef, f: (_: B) => E.Either ) => XRef = (_, f) => bimapEither_(_, (a) => E.right(a), f); /** * Transforms the `get` value of the `XRef` with the specified function. */ export const map: (f: (_: B) => C) => (_: XRef) => XRef = (f) => mapEither((b) => E.right(f(b))); /** * Transforms the `get` value of the `XRef` with the specified function. */ export const map_: (_: XRef, f: (_: B) => C) => XRef = (_, f) => mapEither_(_, (b) => E.right(f(b)));