pub trait Bind: Kind1 {
// Required method
fn bind<'a, A: 'a + Clone, B>(
ma: Apply1<Self, A>,
) -> ArcFn<'a, ArcFn<'a, A, Apply1<Self, B>>, Apply1<Self, B>>;
}
Expand description
Sequences two computations, allowing the second to depend on the value computed by the first.
If x
has type m a
and f
has type a -> m b
, then bind(x)(f)
has type m b
,
representing the result of executing x
to get a value of type a
and then
passing it to f
to get a computation of type m b
.
Note that Bind
is a separate typeclass from Monad
. In this library’s
hierarchy, Monad
is a typeclass that extends both
Applicative
and Bind
.
Required Methods§
Sourcefn bind<'a, A: 'a + Clone, B>(
ma: Apply1<Self, A>,
) -> ArcFn<'a, ArcFn<'a, A, Apply1<Self, B>>, Apply1<Self, B>>
fn bind<'a, A: 'a + Clone, B>( ma: Apply1<Self, A>, ) -> ArcFn<'a, ArcFn<'a, A, Apply1<Self, B>>, Apply1<Self, B>>
Sequences two computations, allowing the second to depend on the value computed by the first.
§Type Signature
forall m a b. Bind m => m a -> (a -> m b) -> m b
§Parameters
ma
: The first computation in the context.f
: A function that takes the result of the first computation and returns the second computation in the context.
§Returns
A computation that sequences the two operations.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.