Semiapplicative

Trait Semiapplicative 

Source
pub trait Semiapplicative: Kind0L1T {
    // Required method
    fn apply<'a, ClonableFnBrand: 'a + ClonableFn, A: 'a + Clone, B: 'a>(
        ff: Apply0L1T<Self, ApplyFn<'a, ClonableFnBrand, A, B>>,
    ) -> ApplyFn<'a, ClonableFnBrand, Apply0L1T<Self, A>, Apply0L1T<Self, B>>;
}
Expand description

A type class for types that support function application within a context.

Semiapplicative 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

Semiapplicative instances must satisfy the following law:

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

Required Methods§

Source

fn apply<'a, ClonableFnBrand: 'a + ClonableFn, A: 'a + Clone, B: 'a>( ff: Apply0L1T<Self, ApplyFn<'a, ClonableFnBrand, A, B>>, ) -> ApplyFn<'a, ClonableFnBrand, Apply0L1T<Self, A>, Apply0L1T<Self, B>>

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

§Type Signature

forall a b. Semiapplicative 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 Semiapplicative for IdentityBrand

Source§

impl Semiapplicative for OptionBrand

Source§

impl Semiapplicative for VecBrand

Source§

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

Source§

impl<First> Semiapplicative for PairWithFirstBrand<First>
where for<'a> Apply1L0T<'a, First>: Semigroup<'a>, for<'a> First: Semigroup1L0T<Output<'a> = First> + Clone,

Source§

impl<Second> Semiapplicative for PairWithSecondBrand<Second>
where for<'a> Apply1L0T<'a, Second>: Semigroup<'a>, for<'a> Second: Semigroup1L0T<Output<'a> = Second> + Clone,

Source§

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