3 ms·
> `sumOf (folded . folded)` does have some advantages in working for lists of other types but I question how often you would reuse such a function for differen
by ParetoOptimal 4y ago
> `sumOf (folded . folded)` does have some advantages in working for lists of other types but I question how often you would reuse such a function for different types the first place.
The common refactor here would be to Either:
> sumOf (folded . folded) [Right 1, Right 2]
3
I don't like the "unwrap the Maybe" or "get rid of the pesky monad in my way" intuition that fromMaybe and catMaybes give beginners.
> A lot of the optics libraries seem to focus a lot on making the general case as easy as possible while overcomplicating the specific case.
I kind of agree with this, but contend the universality of a single powerful and composable lens syntax simplifies things more overall even if it makes a single use site more complicated.