Trait effect_monad::EffectMonad
[−]
[src]
pub trait EffectMonad<A>: Sized { fn bind<B, Eb, F>(self, f: F) -> BoundEffect<Self, F> where Eb: FnOnce() -> B, F: FnOnce(A) -> Eb; fn bind_ignore_contents<B, Eb>(self, eb: Eb) -> BoundEffect<Self, ResolveFn<Eb>> where Eb: FnOnce() -> B { ... } }
Monad trait for effect functions
Required Methods
fn bind<B, Eb, F>(self, f: F) -> BoundEffect<Self, F> where Eb: FnOnce() -> B, F: FnOnce(A) -> Eb
Sequentially composes two effect functions, passing the output of the first to the input of the second
Provided Methods
fn bind_ignore_contents<B, Eb>(self, eb: Eb) -> BoundEffect<Self, ResolveFn<Eb>> where Eb: FnOnce() -> B
Sequentially composes the two effects, while ignoring the return values
of the effects. Similar to the >> function in Haskell, but without
returning the value of the second Monad.
Shorthand for
rust effectMonad.bind(|_| someOtherEffectMonad);
Implementors
impl<T, A> EffectMonad<A> for T where T: FnOnce() -> A