|
>The best part of Haskell is that function application is just whitespace. It's the worst part, in my opinion. Is A B C D equal to A(B(C(D))), A(B,C,D), A(B,C(D)), A(B(C),D) or A(B(C,D))? Often you need to disambiguate with parentheses, so I guess there is some default interpretation that you can assume when reading code, but in the end it just looks like an unnecessary mental translation step. Lisp has weird syntax, but lisp has a reason to have that syntax. Haskell has a weird syntax because it wants to either be different for different's sake or to just be plain inaccessible. |
1. all functions take a single argument (i.e., are curried)
2. function application is left-associative
So "a b c d" is just applying the function "a b c" with the argument "d", the same as "(a b c) d". "a b c" is the application of "c" to the function "a b", which, in turn, is the application of "b" to "a". So "a b c d" is the same as "((a b) c) d".
I personally find using the space symbol for a core concept of the language (function application) very elegant, and not dissimilar to other languages that strive to have simple and consistent syntax, like Smalltalk, where "obj meth1 meth2 meth3" is the same as "((obj meth1) meth2) meth3", even though Haskell and Smalltalk might be as different as programming languages can get :)