apply_second

Function apply_second 

Source
pub fn apply_second<'a, Brand: ApplySecond, A: 'a + Clone, B: 'a + Clone>(
    fa: Apply1L1T<'a, Brand, A>,
    fb: Apply1L1T<'a, Brand, B>,
) -> Apply1L1T<'a, 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.
  • fb: The second context.

§Returns

The second context.

§Examples

use fp_library::classes::apply_second::apply_second;
use fp_library::brands::OptionBrand;

let x = Some(5);
let y = Some(10);
let z = apply_second::<OptionBrand, _, _>(x, y);
assert_eq!(z, Some(10));