Skip to main content

Module bifoldable

Module bifoldable 

Source
Expand description

Data structures with two type arguments that can be folded into a single value.

§Examples

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

let x: Result<i32, i32> = Ok(5);
let y = bi_fold_map::<RcFnBrand, ResultBrand, _, _, _, _, _>(
	(|e: i32| e.to_string(), |s: i32| s.to_string()),
	x,
);
assert_eq!(y, "5".to_string());

Traits§

Bifoldable
A type class for data structures with two type arguments that can be folded.

Functions§

bi_fold_left
Folds the bifoldable structure from left to right using two step functions.
bi_fold_map
Maps elements of both types to a monoid and combines the results.
bi_fold_right
Folds the bifoldable structure from right to left using two step functions.