|
I'm torn. Not about the conciseness of the language overall, but about using symbols vs. names. I do see how the symbols make things more concise, less clutter, and can even make it easier to grasp a piece of code if you are deeply familiar with them[1]. On the other hand, there might be a limit. I do know how it is to use the Haskell lens package only occasionally, and then having to lookup again what the operators read out loud as "percent-percent-at-squiggly" and "hat-dot-dot" stand for (withIndex and toListOf respectively). But arguably, the ones that are long and seldom used need looking up anyway, and their name is not that much more useful maybe? [1] Also compare "2+2*8" with "sum 2 to the product of 2 and 8", or even just "sum(2,prod(2,8))". |
- Operators containing `%` apply a function to the target (mnemonic: % is "mod" in many languages).
- Operators containing `=` have a `MonadState` constraint and operate on the monadic state.
- Operators containing `~` operate directly on values.
- Operators starting with `<` pass through the new value.
- Operators starting with `<<` pass through the old value.
- Operators containing `@` operate on indexed optics (mnemonic: indices tell you where you are "at" in the structure you're traversing).
So an operator like `(<<<>=)` means "semigroup append something in the monadic state and return the old result". This is the power of a well-chosen symbol language, and I don't know how you'd do this ergonomically and compactly with only named operators.