Let’s just say that if you wanted to understand lenses, this is not where you should start; and if you wanted to move to more advanced scenarios, I wouldn’t start here either.
Arrow is how I went from minimal FP to bloody good at it. The Arrow devs are also very giving with their time, and we still interact occasionally online even though I've moved on to Unison for the most part.
Uhhh... Haskell syntax is simpler than python's or javascript's. It's neither obscure nor impenetrable, but it sounds like it's different than what you're used to.
This is such low hanging bait that I'm not even interested in interacting further with it than: Haskell's syntax is obscure and impenetrable for the vast majority of software engineers because it was designed by FP nerds with zero interest in ergonomics.
It doesn't make it a bad syntax. It is, however, objectively terrible for anyone unfamiliar with it.
"infix", "Functor", and "as" are the only words in this code. Everything else is single letters (thanks math traditions..) and punctuation.
What's a <&>? <$>? ::? We've got two different kinds of arrows, => and ->.
-- is obviously enough a line comment.
At least I know what = means.. give or take it's constant ambiguous meaning between languages of assignment and/or equality testing.
And this isn't even delving into the black arts of defining types, where the really ugly punctuation toolkits get opened.
I don't care whether or not they represent regular functions nor what their calling syntax is. What I care is that the base language has many many dozens of them to remember and then to parse in the wild, and then that authors are encouraged to continue proliferating more of them:
```Haskell
-- What does this 'mouse operator' mean? :thinking_suicide:
(~@@^>) :: Functor f => (a -> b) -> (a -> c -> d) -> (b -> f c) -> a -> f d
you're just not familiar with it. like when you ask what "a <&>" means, well this code is literally defining what it means. it means whatever comes after the equals sign
in fact the example you picked is trivially simple even if you dont really know the syntax. all you need to do is not rage out and stop thinking. it's literally saying that "as <&> f" is equal to "f <$> as". so you dont even need to know what <$> is, its extremely straightforward that <&> is just flipping the order of the arguments to <$>
also if you read the type signature then there really arent many possible things this function could do. you start with a Functor a and a function that maps from a to b, and you end up with a Functor b. there's really only one possible implementation of that (applying the function (a -> b) to the a in Functor a)
like im curious, what would you even name these things to make it clearer? it's so abstract in generic in the very concept of it that it's hard to come up with any more specific naming
Kotlin's Arrow library hits a good middle ground between FP wizardry and readability, and their documentation on lenses are understandable for the average person: https://arrow-kt.io/learn/immutable-data/lens/ / https://arrow-kt.io/learn/immutable-data/intro/