Function fmap::monad_fmap

source ·
pub fn monad_fmap<'a, T, B, F>(monad: T, f: F) -> T::Mappedwhere
    T: Monad<'a, B>,
    B: 'a,
    F: 'a + Send + FnMut(T::Inner) -> B,
Expand description

Generic implementation of Functor::fmap for Monads

This generic implementation can be used to define Functor::fmap based on Monad::bind and Pure::pure when the functor is also a monad. A more specific implementation might be more efficient though.