2 ms·
But ... but ... Haskell has the least syntax of any "mainstream" language (save LISP, without macros). Your example of course is `do` notation which is tricky,
by spopejoy 11y ago
But ... but ... Haskell has the least syntax of any "mainstream" language (save LISP, without macros).
Your example of course is `do` notation which is tricky, and is really kind of advanced -- it's much better to use `>>=` `>>` and `return` as long as you can stand before breaking out `do`. If nothing else avoiding `do` will make you write smaller functions!
By "syntax" of course I mean "keywords". Haskell allows for infix operator creativity which you might see as a drawback. I would rather have a language be maximally expressive, allow me to define my own infix swear-word "operators", than be coddled and censored like almost every other language outside C++. But as for built-in syntax, there's hardly any. `$` and `.` are freaking library functions.
As for types, well, types are hard to read. Why shouldn't they be? It's not like templates are easy in C++ once you leave the most trivial exercises. At least Haskell's are formally consistent and fundamentally related to your definitions -- unlike templates which are really macro soup.
In any case, I would find your `M2` definition a lot easier to read with `a` and `b` instead of `a1` and `a2` ...