apply_second

Function apply_second 

Source
pub fn apply_second<'a, Brand: ApplySecond, A: 'a + Clone, B: 'a + Clone>(
    fa: <Brand as Kind_cdc7cd43dac7585f>::Of<'a, A>,
    fb: <Brand as Kind_cdc7cd43dac7585f>::Of<'a, B>,
) -> <Brand as Kind_cdc7cd43dac7585f>::Of<'a, 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

§Type Parameters

  • Brand: The brand of the context.
  • A: The type of the value in the first context.
  • B: The type of the value in the second context.

§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));