pub fn join<'a, Brand: Semimonad, A: 'a>(
mma: <Brand as Kind_cdc7cd43dac7585f>::Of<'a, <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>>,
) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>Expand description
Collapses two nested layers of a semimonad into one.
Equivalent to bind(mma, identity). Removes one level of monadic wrapping
from a doubly-wrapped value.
§Type Signature
forall Brand A. Semimonad Brand => Brand (Brand A) -> Brand A
§Type Parameters
'a: The lifetime of the computation.Brand: The brand of the semimonad.A: The type of the value inside the nested semimonad.
§Parameters
mma: The doubly-wrapped semimonadic value.
§Returns
The singly-wrapped semimonadic value.
§Examples
use fp_library::{
brands::*,
functions::explicit::*,
};
let x = Some(Some(5));
let y = join::<OptionBrand, _, _>(x);
assert_eq!(y, Some(5));
let z: Option<Option<i32>> = Some(None);
assert_eq!(join::<OptionBrand, _, _>(z), None);