Skip to main content

bi_sequence

Function bi_sequence 

Source
pub fn bi_sequence<'a, Brand: Bitraversable, 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 <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.

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

§Type Signature

forall Brand A B F. (Bitraversable 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.
  • 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 = bi_sequence::<ResultBrand, _, _, OptionBrand>(x);
assert_eq!(y, Some(Ok(5)));