View Source Bindable.FlatMap protocol (Bindable v1.1.0)
"Type class" to chain together computations that have a context or effect.
Required to enable for-comprehension for your type.
Inspired by Monad
's bind
(also known as flatMap
or >>=
).
Link to this section Summary
Functions
Takes a computation that produces a value of type a
and a function,
that takes that value and produces a new computation, that produces a value of type b
.
The key feature is that it allows the function to access the value produced by the first computation
and use it to construct the second computation (in contrast with Applicative
's <|>
).
Link to this section Types
@type t() :: term()
All the types that implement this protocol.
Link to this section Functions
@spec flat_map(m(a), (a -> m(b))) :: m(b) when a: var
Takes a computation that produces a value of type a
and a function,
that takes that value and produces a new computation, that produces a value of type b
.
The key feature is that it allows the function to access the value produced by the first computation
and use it to construct the second computation (in contrast with Applicative
's <|>
).