|
|
|
|
|
by klntsky
1287 days ago
|
|
> just to save a few characters and make everything more magic than it is No, this is not the true motivation. Human attention spans on symbols, the more succinct the code is, the more meaning it can encompass in the same number of characters. Writing abstracted enough code often requires inventing new languages to hide the complexity behind abstractions. Software development in Haskell is particularly focused on DSLs, lens language being one of them. ^.. is a relatively simple operator though, it just abstracts away traversals. |
|
Human attention may pick out symbols more easily, but human comprehension benefits from things that actually have meaning. Otherwise you end up with a soup of ASCII symbols that very few can parse since every library in Haskell seems hellbent on inventing new and useless ascii combinations for function names and operators.
Even the article goes (emphasis mine):
--- start quote ---
The basic operators here are ^., .~, and %~. If you’re not a fan of funny-looking operators, Control.Lens provides more helpfully-named functions called view, set, and over (a.k.a. mapping)
--- end quote ---
And then proceeds to use the ASCII soup instead of the more helpful function names.
It doesn't help in the least that there are multiple get operations ^. ^? ^.. Or this idiocy: "Here, a single < before the operator signifies that it returns the updated value, while a double << signifies that it returns the old value. This gets a little weird with the monoidal operator; <<>~ returns the updated value, not the old one". Bonus points. What does this do: <<<>~
Because "why have useful names when you can pretend your fake intellectual superiority by using confusing ascii symbol combinations"
> Software development in Haskell is particularly focused on DSLs, lens language being one of them.
The domain specific language for lenses is view, set, traverse, update etc. Not whatever this is.