pub fn compose<'a, Brand: Semigroupoid, B: 'a, C: 'a, D: 'a>(
f: <Brand as Kind_140eb1e35dc7afb3>::Of<'a, C, D>,
g: <Brand as Kind_140eb1e35dc7afb3>::Of<'a, B, C>,
) -> <Brand as Kind_140eb1e35dc7afb3>::Of<'a, B, D>Expand description
Takes morphisms f and g and returns the morphism f . g (f composed with g).
Free function version that dispatches to the type class’ associated function.
§Type Signature
forall brand b c d. Semigroupoid brand => (brand c d, brand b c) -> brand b d
§Type Parameters
'a: The lifetime of the morphisms.Brand: The brand of the semigroupoid.B: The source type of the first morphism.C: The target type of the first morphism and the source type of the second morphism.D: The target type of the second morphism.
§Parameters
f: The second morphism to apply (from C to D).g: The first morphism to apply (from B to C).
§Returns
The composed morphism (from B to D).
§Examples
use fp_library::{brands::*, classes::*, functions::*};
let f = cloneable_fn_new::<RcFnBrand, _, _>(|x: i32| x * 2);
let g = cloneable_fn_new::<RcFnBrand, _, _>(|x: i32| x + 1);
let h = semigroupoid_compose::<RcFnBrand, _, _, _>(f, g);
assert_eq!(h(5), 12); // (5 + 1) * 2