pub fn bind<'a, FA, A: 'a, B: 'a, Marker>(
ma: FA,
f: impl BindDispatch<'a, <FA as InferableBrand_cdc7cd43dac7585f>::Brand, A, B, FA, Marker>,
) -> <<FA as InferableBrand_cdc7cd43dac7585f>::Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>where
FA: InferableBrand_cdc7cd43dac7585f,Expand description
Sequences a monadic computation, inferring the brand from the container type.
The Brand type parameter is inferred from the concrete type of ma
via InferableBrand. Both owned and borrowed containers are supported.
For types with multiple brands, use
explicit::bind with a turbofish.
§Type Signature
forall Brand A B. Semimonad Brand => (Brand A, A -> Brand B) -> Brand B
§Type Parameters
'a: The lifetime of the values.FA: The container type (owned or borrowed). Brand is inferred from this.A: The type of the value inside the monad.B: The type of the result.Marker: Dispatch marker type, inferred automatically.
§Parameters
ma: The monadic value (owned for Val, borrowed for Ref).f: The function to apply to the value.
§Returns
The result of sequencing the computation.
§Examples
use fp_library::functions::*;
let result = bind(Some(5), |x: i32| Some(x * 2));
assert_eq!(result, Some(10));