Skip to main content

Module ref_bitraversable

Module ref_bitraversable 

Source
Expand description

By-reference traversal of bifunctor structures.

§Examples

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

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

Traits§

RefBitraversable
A type class for data structures with two type arguments that can be traversed by reference.

Functions§

ref_bi_for
Traverses the bitraversable structure by reference with arguments flipped.
ref_bi_for_left
Traverses only the first-position elements by reference with arguments flipped.
ref_bi_for_right
Traverses only the second-position elements by reference with arguments flipped.
ref_bi_sequence
Sequences a bitraversable structure containing applicative values by reference.
ref_bi_traverse
Traverses a bitraversable structure by reference with two effectful functions.
ref_bi_traverse_left
Traverses only the first-position elements by reference, lifting second-position elements via pure.
ref_bi_traverse_right
Traverses only the second-position elements by reference, lifting first-position elements via pure.