Suppose I have two functions with the following types.
f :: (a, b) -> c
g :: (a, b, c) -> d
I can compose them as follows.
function h(a, b) {
const c = f(a, b);
const d = g(a, b, c);
return d;
}
Here, h is a composition of g and f. However, this looks a lot like imperative code with the constant declarations and the return statement. How can I compose any two such functions in a functional style?
gwould simply usef. Instead ofg :: (a, b, d) --> <do something with a, b, and d>it would look likeg :: (a, b) -> < do something with a, b, and f(a, b)>