Skip to main content

split_strong

Function split_strong 

Source
pub fn split_strong<'a, Brand: Semigroupoid + Strong, A: 'a, B: 'a, C: 'a, D: 'a>(
    l: <Brand as Kind_266801a817966495>::Of<'a, A, B>,
    r: <Brand as Kind_266801a817966495>::Of<'a, C, D>,
) -> <Brand as Kind_266801a817966495>::Of<'a, (A, C), (B, D)>
Expand description

Compose a value acting on a pair from two values, each acting on one component of the pair.

Equivalent to PureScript’s splitStrong / (***).

§Type Signature

forall Brand A B C D. (Semigroupoid Brand, Strong Brand) => (Brand A B, Brand C D) -> Brand (A, C) (B, D)

§Type Parameters

  • 'a: The lifetime of the values.
  • Brand: The brand of the strong profunctor.
  • A: The input type of the first profunctor.
  • B: The output type of the first profunctor.
  • C: The input type of the second profunctor.
  • D: The output type of the second profunctor.

§Parameters

  • l: The profunctor acting on the first component.
  • r: The profunctor acting on the second component.

§Returns

A new profunctor that maps the first component via l and the second via r.

§Examples

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

let f = lift_fn_new::<RcFnBrand, _, _>(|x: i32| x + 1);
let g = lift_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2);
let h = split_strong::<RcFnBrand, _, _, _, _>(f, g);
assert_eq!(h((10, 20)), (11, 40));