A generic compose function that takes multiple functions as input
and outputs a single function where input = input of the first function
and output = output where every funtion has been applied to the output of the previous one.
So
compose(f1:(x:A)=>B, f2:(x:B)=>C, f3:(x:C)=>D)
will return a single unary function
(a:A):D=>f3(f2(f1(a)))
Returns
Type Parameters
A
B
Parameters
fn1: ((x: A) => B)
(x: A): B
Parameters
x: A
Returns B
Returns ((x: A) => B)
(x: A): B
Parameters
x: A
Returns B
compose<A, B, C>(fn1: ((x: A) => B), fn2: ((x: B) => C)): ((x: A) => C)
Type Parameters
A
B
C
Parameters
fn1: ((x: A) => B)
(x: A): B
Parameters
x: A
Returns B
fn2: ((x: B) => C)
(x: B): C
Parameters
x: B
Returns C
Returns ((x: A) => C)
(x: A): C
Parameters
x: A
Returns C
compose<A, B, C, D>(fn1: ((x: A) => B), fn2: ((x: B) => C), fn3: ((x: C) => D)): ((x: A) => D)
Type Parameters
A
B
C
D
Parameters
fn1: ((x: A) => B)
(x: A): B
Parameters
x: A
Returns B
fn2: ((x: B) => C)
(x: B): C
Parameters
x: B
Returns C
fn3: ((x: C) => D)
(x: C): D
Parameters
x: C
Returns D
Returns ((x: A) => D)
(x: A): D
Parameters
x: A
Returns D
compose<A, B, C, D, E>(fn1: ((x: A) => B), fn2: ((x: B) => C), fn3: ((x: C) => D), fn4: ((x: D) => E)): ((x: A) => E)
Type Parameters
A
B
C
D
E
Parameters
fn1: ((x: A) => B)
(x: A): B
Parameters
x: A
Returns B
fn2: ((x: B) => C)
(x: B): C
Parameters
x: B
Returns C
fn3: ((x: C) => D)
(x: C): D
Parameters
x: C
Returns D
fn4: ((x: D) => E)
(x: D): E
Parameters
x: D
Returns E
Returns ((x: A) => E)
(x: A): E
Parameters
x: A
Returns E
compose<A, B, C, D, E, F>(fn1: ((x: A) => B), fn2: ((x: B) => C), fn3: ((x: C) => D), fn4: ((x: D) => E), fn5: ((x: E) => F)): ((x: A) => F)
Type Parameters
A
B
C
D
E
F
Parameters
fn1: ((x: A) => B)
(x: A): B
Parameters
x: A
Returns B
fn2: ((x: B) => C)
(x: B): C
Parameters
x: B
Returns C
fn3: ((x: C) => D)
(x: C): D
Parameters
x: C
Returns D
fn4: ((x: D) => E)
(x: D): E
Parameters
x: D
Returns E
fn5: ((x: E) => F)
(x: E): F
Parameters
x: E
Returns F
Returns ((x: A) => F)
(x: A): F
Parameters
x: A
Returns F
compose<A, B, C, D, E, F, G>(fn1: ((x: A) => B), fn2: ((x: B) => C), fn3: ((x: C) => D), fn4: ((x: D) => E), fn5: ((x: E) => F), fn6: ((x: F) => G)): ((x: A) => G)
Type Parameters
A
B
C
D
E
F
G
Parameters
fn1: ((x: A) => B)
(x: A): B
Parameters
x: A
Returns B
fn2: ((x: B) => C)
(x: B): C
Parameters
x: B
Returns C
fn3: ((x: C) => D)
(x: C): D
Parameters
x: C
Returns D
fn4: ((x: D) => E)
(x: D): E
Parameters
x: D
Returns E
fn5: ((x: E) => F)
(x: E): F
Parameters
x: E
Returns F
fn6: ((x: F) => G)
(x: F): G
Parameters
x: F
Returns G
Returns ((x: A) => G)
(x: A): G
Parameters
x: A
Returns G
compose<A, B, C, D, E, F, G, H>(fn1: ((x: A) => B), fn2: ((x: B) => C), fn3: ((x: C) => D), fn4: ((x: D) => E), fn5: ((x: E) => F), fn6: ((x: F) => G), fn7: ((x: G) => H)): ((x: A) => H)
A generic compose function that takes multiple functions as input and outputs a single function where input = input of the first function and output = output where every funtion has been applied to the output of the previous one.
So
will return a single unary function
Returns