Module Relude_Function.Infix

The Infix submodule provides two infix operators for function composition.

open Relude.Function.Infix;
let (<<): ('a => 'b) => ('c => 'a) => 'c => 'b;

The << operator returns a function that is the equivalent of calling compose() with its function arguments.

(f << g)(x) is the equivalent of f(g(x)).

let sqrtCompFloor = sqrt << floor;
sqrtCompFloor(4.5) == 2.0;
let (>>): ('a => 'b) => ('b => 'c) => 'a => 'c;

The >> operator returns a function that is the equivalent of calling flipCompose() with its function arguments.

(f >> g)(x) is the equivalent of g(f(x)).

let floorFlipSqrt = floor >> sqrt;
floorFlipSqrt(4.5) == 2.0;