Skip to main content

ref_bi_sequence

Function ref_bi_sequence 

Source
pub fn ref_bi_sequence<'a, Brand: RefBitraversable, FnBrand, A: 'a + Clone, B: 'a + Clone, F: Applicative>(
    ta: &<Brand as Kind_266801a817966495>::Of<'a, <F as Kind_cdc7cd43dac7585f>::Of<'a, A>, <F as Kind_cdc7cd43dac7585f>::Of<'a, B>>,
) -> <F as Kind_cdc7cd43dac7585f>::Of<'a, <Brand as Kind_266801a817966495>::Of<'a, A, B>>
where FnBrand: LiftFn + 'a, <Brand as Kind_266801a817966495>::Of<'a, A, B>: Clone, <F as Kind_cdc7cd43dac7585f>::Of<'a, A>: Clone, <F as Kind_cdc7cd43dac7585f>::Of<'a, B>: Clone,
Expand description

Sequences a bitraversable structure containing applicative values by reference.

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

§Type Signature

forall Brand A B F. (RefBitraversable Brand, Applicative F) => &Brand (F A) (F B) -> F (Brand A B)

§Type Parameters

  • 'a: The lifetime of the values.
  • Brand: The brand of the bitraversable structure.
  • FnBrand: The brand of the cloneable function wrapper.
  • A: The type of the first-position elements.
  • B: The type of the second-position elements.
  • F: The applicative context.

§Parameters

  • ta: The bitraversable structure containing applicative values.

§Returns

The applicative context wrapping the bitraversable structure.

§Examples

use fp_library::{
	brands::*,
	functions::*,
};

let x: Result<Option<i32>, Option<i32>> = Ok(Some(5));
let y = ref_bi_sequence::<ResultBrand, RcFnBrand, _, _, OptionBrand>(&x);
assert_eq!(y, Some(Ok(5)));