Function map

Source
pub fn map<Brand, F, A, B>(
    f: F,
) -> impl Fn(Apply<Brand, (A,)>) -> Apply<Brand, (B,)>
where Brand: Kind<(A,)> + Kind<(B,)> + Functor, F: Fn(A) -> B,
Expand description

Maps a function over the values in the functor context.

Free function version that dispatches to the typeclass method.

§Type Signature

forall f a b. Functor f => (a -> b) -> f a -> f b

§Examples

use fp_library::{brands::OptionBrand, functions::map};

assert_eq!(map::<OptionBrand, _, _, _>(|x: i32| x * 2)(Some(5)), Some(10));