Skip to main content

Module bitraversable

Module bitraversable 

Source
Expand description

Data structures with two type arguments that can be traversed in an applicative context.

§Examples

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

let x: Result<i32, i32> = Ok(5);
let y = bi_traverse::<ResultBrand, _, _, _, _, OptionBrand>(
	|e: i32| Some(e + 1),
	|s: i32| Some(s * 2),
	x,
);
assert_eq!(y, Some(Ok(10)));

Traits§

Bitraversable
A type class for data structures with two type arguments that can be traversed.

Functions§

bi_for
Traverses the bitraversable structure with arguments flipped.
bi_sequence
Sequences a bitraversable structure containing applicative values.
bi_traverse
Traverses the bitraversable structure with two effectful functions.
for_left
Traverses only the first-position elements with arguments flipped.
for_right
Traverses only the second-position elements with arguments flipped.
traverse_left
Traverses only the first-position elements, leaving second-position elements unchanged via pure.
traverse_right
Traverses only the second-position elements, leaving first-position elements unchanged via pure.