Skip to main content

Module foldable

Module foldable 

Source
Expand description

Data structures that can be folded into a single value from the left or right.

§Examples

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

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.