pub fn bind<'a, Brand: Semimonad, A: 'a, B: 'a, F>(
ma: <Brand as Kind_c3c3610c70409ee6>::Of<'a, A>,
f: F,
) -> <Brand as Kind_c3c3610c70409ee6>::Of<'a, B>Expand description
Sequences two computations, allowing the second to depend on the value computed by the first.
Free function version that dispatches to the type class’ associated function.
§Type Signature
forall a b. Semimonad m => (m a, a -> m b) -> m b
§Parameters
ma: The first computation.f: The function to apply to the result of the first computation.
§Returns
The result of the second computation.
§Examples
use fp_library::classes::semimonad::bind;
use fp_library::brands::OptionBrand;
let x = Some(5);
let y = bind::<OptionBrand, _, _, _>(x, |i| Some(i * 2));
assert_eq!(y, Some(10));