> the name of the function again when closing the definition
I think that's just a comment. It follows '%' as in TeX.
But yes, nowadays programmers tend to love concise syntax (myself included), not to mention elegant syntax, which is ever harder to define.
For example we make a big deal about being able to type 'x => x * 2' instead of 'function (x) { return x * 2; }' in Javascript, or '[]' instead of 'array()' in PHP. One of the draws of ML-derived functional languages (such as Haskell) and maybe APL-derived ones is the fact that they are very much 'shorthand' programming languages.
At the same time, one should not stop at the syntax, but try to understand the ideas behind a programming language. Syntax can always be improved with a bit of aesthetic sense, but good ideas are hard to come by.
It would be nice if Haskell could figure out (-) functions; as it is, it always consider things like (- 2) to be a number, not a function (even when only a function would typecheck).
ML might have had the right idea, using op~ for unary negation and op- for binary subtraction. I definitely would not want parsing to depend on type declarations; that's a slippery slope towards Perl...
I suspect that you could do this already using typeclasses. We want (-2) to be a function of the type `Num a => a -> a`, so we could, in theory, make functions of this type an instance of Num.
I do not immediately see this causing problems for correct programs, but it would probably lead to horribly confusing problems in incorrect code, including converting some type errors into runtime errors.
A simpler approach is to say that you can not have a space after the unary "-", so (-2) parses to a numeric literal, and (- 2) parses to a function.
Not at all. Syntax is only the first step. Then comes imperativeness. If you can't write what's essentially Java code in its syntax, it's not going to be a thing.
Agreed. You have your bits of logic that are great for a functional sort of style...map and fold and transform this data...then sometimes you have a script-like area that really benefits from an imperative style...open this, save this off, close this, if error do this, etc.
I think that's just a comment. It follows '%' as in TeX.
But yes, nowadays programmers tend to love concise syntax (myself included), not to mention elegant syntax, which is ever harder to define.
For example we make a big deal about being able to type 'x => x * 2' instead of 'function (x) { return x * 2; }' in Javascript, or '[]' instead of 'array()' in PHP. One of the draws of ML-derived functional languages (such as Haskell) and maybe APL-derived ones is the fact that they are very much 'shorthand' programming languages.
At the same time, one should not stop at the syntax, but try to understand the ideas behind a programming language. Syntax can always be improved with a bit of aesthetic sense, but good ideas are hard to come by.