I’m a little confused about what you mean by some of the boxes in the diagram so I cannot say whether or not your understanding is accurate.
What I can say is that the box in red has a false presupposition. I don’t know if your sentence means “why doesn’t sq $
throw an error” or “why doesn’t sq $ sqrt $ 7 + 9
throw an error”, but either way, both of those will throw errors. Specifically, both of them are functions and functions do not have a Show instance so if you ask GHCi to print them (which is what typing an expression into it and pressing enter does), it will give you an error saying that there isn’t an instance of Show for the type of the expression. If sq
takes two arguments then sq $
is a function waiting for two arguments, so you can’t show it in GHCi. Similarly, sq $ sqrt $ 7 + 9
is a function which is still waiting for one argument and then will apply sq to 4 and that number, and again that cannot be shown in the REPL. If sq
took one argument then sq $ sqrt $ 7 + 9
would return a value, specifically whatever value sq
gives when given 4. So, I’m not really sure what you meant in the red box.
Edit: what ntwilson said above is probably the actual issue that is causing confusion.
sq $ sqrt $ 7 + 9
is not sq
being applied to two expressions, it is $
being applied to two expressions, one of which is sq
and the other of which is sqrt $ 7 + 9
, in the same way that 7 + 9
is not 7
being applied to two expressions, it’s (+)
being applied to 7
and 9
.
A lot of these issues can be checked on your own by typing them into GHCi and seeing that they do give errors.