pub fn apply<'a, ClonableFnBrand: 'a + ClonableFn, Brand: Semiapplicative, A: 'a + Clone, B: 'a>(
ff: Apply0L1T<Brand, ApplyFn<'a, ClonableFnBrand, A, B>>,
) -> ApplyFn<'a, ClonableFnBrand, Apply0L1T<Brand, A>, Apply0L1T<Brand, B>>Expand description
Applies a function within a context to a value within a context.
Free function version that dispatches to the type class’ associated function.
§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.
§Examples
use fp_library::{brands::{OptionBrand, RcFnBrand}, functions::apply};
use std::rc::Rc;
assert_eq!(
apply::<RcFnBrand, OptionBrand, _, _>(Some(Rc::new(|x: i32| x * 2)))(Some(5)),
Some(10)
);