Expand description
Data structures that can be traversed, accumulating results in an applicative context.
§Examples
use fp_library::{functions::*, brands::*};
let x = Some(5);
let y = traverse::<OptionBrand, _, _, OptionBrand, _>(|a| Some(a * 2), x);
assert_eq!(y, Some(Some(10)));Traits§
- Traversable
- A type class for traversable functors.
Functions§
- sequence
- Evaluate each computation in a
Traversablestructure and accumulate the results into anApplicativecontext. - traverse
- Map each element of the
Traversablestructure to a computation, evaluate those computations and combine the results into anApplicativecontext.