Skip to main content Link Search Menu Expand Document (external link)

Bicovariant overview

Added in v0.24.0


Table of contents


type class

Bicovariant (interface)

Signature

export interface Bicovariant<F extends TypeLambda> extends TypeClass<F> {
  readonly bimap: {
    <E1, E2, A, B>(f: (e: E1) => E2, g: (a: A) => B): <R, O>(self: Kind<F, R, O, E1, A>) => Kind<F, R, O, E2, B>
    <R, O, E1, A, E2, B>(self: Kind<F, R, O, E1, A>, f: (e: E1) => E2, g: (a: A) => B): Kind<F, R, O, E2, B>
  }
}

Added in v0.24.0

utils

bimapComposition

Returns a default ternary bimap composition.

Signature

export declare const bimapComposition: <F extends TypeLambda, G extends TypeLambda>(
  CovariantF: Covariant<F>,
  BicovariantG: Bicovariant<G>
) => <FR, FO, FE, GR, GO, E1, A, E2, B>(
  self: Kind<F, FR, FO, FE, Kind<G, GR, GO, E1, A>>,
  f: (e: E1) => E2,
  g: (a: A) => B
) => Kind<F, FR, FO, FE, Kind<G, GR, GO, E2, B>>

Added in v0.24.0

map

Returns a default map implementation.

Signature

export declare const map: <F extends TypeLambda>(F: Bicovariant<F>) => Covariant<F>["map"]

Added in v0.24.0

mapLeft

Returns a default mapLeft implementation.

Signature

export declare const mapLeft: <F extends TypeLambda>(
  F: Bicovariant<F>
) => {
  <E, G>(f: (e: E) => G): <R, O, A>(self: Kind<F, R, O, E, A>) => Kind<F, R, O, G, A>
  <R, O, E, A, G>(self: Kind<F, R, O, E, A>, f: (e: E) => G): Kind<F, R, O, G, A>
}

Added in v0.24.0