Skip to main content

Functor

Trait Functor 

Source
pub trait Functor: HKT {
    // Required method
    fn fmap<A, B>(fa: Self::Of<A>, f: impl Fn(A) -> B) -> Self::Of<B>;
}
Expand description

Covariant functor: lifts a function A -> B into F<A> -> F<B>.

Required Methods§

Source

fn fmap<A, B>(fa: Self::Of<A>, f: impl Fn(A) -> B) -> Self::Of<B>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl Functor for IdentityF

Source§

impl Functor for NonEmptyVecF

Available on crate features alloc or std only.
Source§

impl Functor for OptionF

Source§

impl Functor for VecF

Available on crate features alloc or std only.
Source§

impl<E> Functor for EnvF<E>

Source§

impl<E> Functor for ResultF<E>

Source§

impl<F, G> Functor for ComposeF<F, G>
where F: Functor, G: Functor,

Functors compose: if F and G are both Functors, so is F . G.

Source§

impl<F> Functor for CofreeF<F>
where F: HKT + Functor,

Source§

impl<F> Functor for FixF<F>
where F: HKT + Functor,

Source§

impl<F> Functor for FreeF<F>
where F: HKT + Functor,