Trait higher::Functor

source ·
pub trait Functor<'a, A> {
    type Target<T>;

    fn fmap<B, F>(self, f: F) -> Self::Target<B>
    where
        F: Fn(A) -> B + 'a
; }
Expand description

A Functor lets you change the type parameter of a generic type.

A Functor defines a method fmap on a type F<_>: Functor which converts an F<A> to F<B> using a function Fn(A) -> B applied to the As inside it.

You can also use this just to modify the values inside your container value without changing their type, if the mapping function returns a value of the same type. This is called an “endofunctor.”

Required Associated Types§

Required Methods§

Implementations on Foreign Types§

Implementors§