Skip to main content

Module functor

Module functor 

Source
Expand description

Types that can be mapped over, allowing functions to be applied to values within a context.

§Examples

use fp_library::{brands::*, functions::*};

let x = Some(5);
let y = map::<OptionBrand, _, _, _>(|i| i * 2, x);
assert_eq!(y, Some(10));

Traits§

Functor
A type class for types that can be mapped over.

Functions§

map
Maps a function over the values in the functor context.