Considering Haskell has currying functions, we can do this:
foo a b = a + b -- equivalent to `foo a = \b -> a + b`
foo 1 -- ok, returns `\b -> 1 + b`
foo 1 2 -- ok, returns 3
Declaring the function returning a lambda, just like in the comment, works just fine as well.
But when I compose these functions, like this:
foo a b = a + b
bar x = x * x
bar . foo 1 -- ok, returns a lambda
bar . foo 1 2 -- wrong, I need to write `(bar . foo 1) 2`
Then it results in an error.
The question is: why are the parentheses around the function composition necessary?