Skip to main content

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 brand a b. ApplySecond brand => (brand a, brand b) -> brand b

§Type Parameters

  • 'a: The lifetime of the values.
  • 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::{brands::*, functions::*};

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