pub trait Bifunctor<C, D>: Higher2 {
    // Required method
    fn bimap(
        self,
        f: impl FnMut(Self::Param1) -> C,
        g: impl FnMut(Self::Param2) -> D
    ) -> Self::Target<C, D>;
}
Expand description

Bifunctor takes two type parameters instead of one, and is a functor in both of these parameters. It defines a function bimap, which allows for mapping over both arguments at the same time

Required Methods§

source

fn bimap( self, f: impl FnMut(Self::Param1) -> C, g: impl FnMut(Self::Param2) -> D ) -> Self::Target<C, D>

Transform a Self<A, B> into a Self<C, D> by providing a transformation from A to C and from ‘B’ to ‘D’

Implementations on Foreign Types§

source§

impl<A, B, C: Eq + Hash, D> Bifunctor<C, D> for HashMap<A, B>

source§

fn bimap(self, f: impl FnMut(A) -> C, g: impl FnMut(B) -> D) -> HashMap<C, D>

source§

impl<A, B, C, D> Bifunctor<C, D> for (A, B)

source§

fn bimap(self, f: impl FnMut(A) -> C, g: impl FnMut(B) -> D) -> (C, D)

source§

impl<A, B, C, D> Bifunctor<C, D> for Result<A, B>

source§

fn bimap(self, f: impl FnMut(A) -> C, g: impl FnMut(B) -> D) -> Result<C, D>

Implementors§

source§

impl<A, B, C, D> Bifunctor<C, D> for Validated<A, B>