Apply

Trait Apply 

Source
pub trait Apply: Kind1 {
    // Required method
    fn apply<'a, A: 'a + Clone, B: 'a>(
        ff: Apply1<Self, ArcFn<'a, A, B>>,
    ) -> ArcFn<'a, Apply1<Self, A>, Apply1<Self, B>>
       where Apply1<Self, ArcFn<'a, A, B>>: Clone;
}
Expand description

A typeclass for types that support function application within a context.

Apply provides the ability to apply functions that are themselves wrapped in a context to values that are also wrapped in a context. This allows for sequencing computations where both the function and the value are in a context.

§Laws

Apply instances must satisfy the following law:

  • Composition: apply(apply(f)(g))(x) = apply(f)(apply(g)(x)).

Required Methods§

Source

fn apply<'a, A: 'a + Clone, B: 'a>( ff: Apply1<Self, ArcFn<'a, A, B>>, ) -> ArcFn<'a, Apply1<Self, A>, Apply1<Self, B>>
where Apply1<Self, ArcFn<'a, A, B>>: Clone,

Applies a function within a context to a value within a context.

§Type Signature

forall f a b. Apply f => f (a -> b) -> f a -> f b

§Parameters
  • ff: A function wrapped in the context.
  • fa: A value wrapped in the context.
§Returns

The result of applying the function to the value, all within the context.

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.

Implementors§

Source§

impl Apply for OptionBrand

Source§

impl Apply for SoloBrand

Source§

impl Apply for VecBrand

Source§

impl<E> Apply for ResultWithErrBrand<E>
where for<'a> E: Clone + 'a,

Source§

impl<T> Apply for ResultWithOkBrand<T>
where for<'a> T: Clone + 'a,