Skip to main content

pipe3

Function pipe3 

Source
pub fn pipe3<A, B, C, D>(
    a: A,
    f: impl FnOnce(A) -> B,
    g: impl FnOnce(B) -> C,
    h: impl FnOnce(C) -> D,
) -> D
Expand description

Apply three functions in sequence (ternary pipe).

pipe3(x, f, g, h) ≡ h(g(f(x)))

§Examples

use effectful::foundation::function::pipe3;

assert_eq!(pipe3(2, |n| n + 1, |n| n * 2, |n| n - 1), 5);