pub fn apply_first<'a, ClonableFnBrand: 'a + ClonableFn, Brand: ApplyFirst, A: 'a + Clone, B: Clone>(
fa: Apply0L1T<Brand, A>,
) -> ApplyFn<'a, ClonableFnBrand, Apply0L1T<Brand, B>, Apply0L1T<Brand, A>>
Expand description
Combines two contexts, keeping the value from the first context.
Free function version that dispatches to the type class’ associated function.
§Type Signature
forall a b. ApplyFirst f => f a -> f b -> f a
§Parameters
fa
: The first context containing a value.fb
: The second context containing a value (will be discarded).
§Returns
The first context with its value preserved.
§Examples
use fp_library::{brands::{OptionBrand, RcFnBrand}, functions::apply_first};
assert_eq!(apply_first::<RcFnBrand, OptionBrand, _, _>(Some(5))(Some("hello")), Some(5));