Expand description
Data structures that can be folded into a single value from the left or right.
§Examples
use fp_library::{brands::*, functions::*};
let x = Some(5);
let y = fold_right::<RcFnBrand, OptionBrand, _, _, _>(|a, b| a + b, 10, x);
assert_eq!(y, 15);Traits§
- Foldable
- A type class for structures that can be folded to a single value.
Functions§
- fold_
left - Folds the structure by applying a function from left to right.
- fold_
map - Maps values to a monoid and combines them.
- fold_
right - Folds the structure by applying a function from right to left.