apply_second

Function apply_second 

Source
pub fn apply_second<'a, ClonableFnBrand: 'a + ClonableFn, Brand: ApplySecond, A: 'a + Clone, B: 'a + Clone>(
    fa: Apply0L1T<Brand, A>,
) -> ApplyFn<'a, ClonableFnBrand, Apply0L1T<Brand, B>, Apply0L1T<Brand, B>>
Expand description

Combines two contexts, keeping the value from the second context.

Free function version that dispatches to the type class’ associated function.

§Type Signature

forall a b. ApplySecond f => f a -> f b -> f b

§Parameters

  • fa: The first context containing a value (will be discarded).
  • fb: The second context containing a value.

§Returns

The second context with its value preserved.

§Examples

use fp_library::{brands::{OptionBrand, RcFnBrand}, functions::apply_second};

assert_eq!(apply_second::<RcFnBrand, OptionBrand, _, _>(Some(5))(Some("hello")), Some("hello"));