Expand description
By-reference withering (effectful filtering) of structures.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
let v = vec![1, 2, 3, 4, 5];
let result: Option<Vec<i32>> = wither::<RcFnBrand, VecBrand, OptionBrand, _, _, _, _>(
|x: &i32| if *x > 3 { Some(Some(*x)) } else { Some(None) },
&v,
);
assert_eq!(result, Some(vec![4, 5]));Traits§
- RefWitherable
- By-reference withering (effectful filtering) of structures.
Functions§
- ref_
wilt - Partitions by reference in an applicative context.
- ref_
wither - Filters by reference in an applicative context.