pub trait Profunctor: HKT2 {
// Required method
fn dimap<A, B, C, D>(
f: impl Fn(C) -> A + 'static,
g: impl Fn(B) -> D + 'static,
pab: Self::P<A, B>,
) -> Self::P<C, D>
where A: 'static,
B: 'static;
// Provided methods
fn lmap<A, B, C>(
f: impl Fn(C) -> A + 'static,
pab: Self::P<A, B>,
) -> Self::P<C, B>
where A: 'static,
B: 'static { ... }
fn rmap<A, B, D>(
g: impl Fn(B) -> D + 'static,
pab: Self::P<A, B>,
) -> Self::P<A, D>
where A: 'static,
B: 'static { ... }
}Expand description
A profunctor is contravariant in its first argument and covariant in its second.
Laws:
- Identity:
dimap(id, id, p) == p - Composition:
dimap(f . g, h . i, p) == dimap(g, h, dimap(f, i, p))
Required Methods§
fn dimap<A, B, C, D>(
f: impl Fn(C) -> A + 'static,
g: impl Fn(B) -> D + 'static,
pab: Self::P<A, B>,
) -> Self::P<C, D>where
A: 'static,
B: 'static,
Provided Methods§
fn lmap<A, B, C>(
f: impl Fn(C) -> A + 'static,
pab: Self::P<A, B>,
) -> Self::P<C, B>where
A: 'static,
B: 'static,
fn rmap<A, B, D>(
g: impl Fn(B) -> D + 'static,
pab: Self::P<A, B>,
) -> Self::P<A, D>where
A: 'static,
B: 'static,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".