fp-ts-std
Version:
The missing pseudo-standard library for fp-ts.
30 lines • 1.57 kB
TypeScript
/**
* Utility functions to accommodate `fp-ts/Bifunctor`.
*
* @since 0.14.0
*/
import type { Bifunctor, Bifunctor2, Bifunctor2C, Bifunctor3, Bifunctor3C, Bifunctor4 } from "fp-ts/Bifunctor";
import type { Kind2, Kind3, Kind4, URIS2, URIS3, URIS4 } from "fp-ts/HKT";
/**
* Apply a function to both elements of a bifunctor.
*
* @example
* import { pipe } from 'fp-ts/function'
* import { mapBoth } from 'fp-ts-std/Bifunctor'
* import * as Tuple from 'fp-ts/Tuple'
* import { multiply } from 'fp-ts-std/Number'
*
* const xs = pipe([3, 5], mapBoth(Tuple.Bifunctor)(multiply(2)))
*
* assert.deepStrictEqual(xs, [6, 10])
*
* @category 2 Typeclass Methods
* @since 0.14.0
*/
export declare function mapBoth<F extends URIS4>(F: Bifunctor4<F>): <A, B>(f: (x: A) => B) => <S, R>(x: Kind4<F, S, R, A, A>) => Kind4<F, S, R, B, B>;
export declare function mapBoth<F extends URIS3>(F: Bifunctor3<F>): <A, B>(f: (x: A) => B) => <R>(x: Kind3<F, R, A, A>) => Kind3<F, R, B, B>;
export declare function mapBoth<F extends URIS3, E>(F: Bifunctor3C<F, E>): <B>(f: (x: E) => B) => <R>(x: Kind3<F, R, E, E>) => Kind3<F, R, B, B>;
export declare function mapBoth<F extends URIS2>(F: Bifunctor2<F>): <A, B>(f: (x: A) => B) => (x: Kind2<F, A, A>) => Kind2<F, B, B>;
export declare function mapBoth<F extends URIS2, E>(F: Bifunctor2C<F, E>): <B>(f: (x: E) => B) => (x: Kind2<F, E, E>) => Kind2<F, B, B>;
export declare function mapBoth<F extends URIS2>(F: Bifunctor<F>): <A, B>(f: (x: A) => B) => (x: Kind2<F, A, A>) => Kind2<F, B, B>;
//# sourceMappingURL=Bifunctor.d.ts.map