Haskell Language Function call syntax Parentheses in embedded function calls

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

In the previous example, we didn't end up needing the parentheses, because they did not affect the meaning of the statement. However, they are often necessary in more complex expression, like the one below.
In C:

plus(a, take(b, c));

In Haskell this becomes:

(plus a (take b c))
-- or equivalently, omitting the outermost parentheses
plus a (take b c)

Note, that this is not equivalent to:

plus a take b c -- Not what we want!

One might think that because the compiler knows that take is a function, it would be able to know that you want to apply it to the arguments b and c, and pass its result to plus.
However, in Haskell, functions often take other functions as arguments, and little actual distinction is made between functions and other values; and so the compiler cannot assume your intention simply because take is a function.

And so, the last example is analogous to the following C function call:

plus(a, take, b, c); // Not what we want!


Got any Haskell Language Question?