In the end the vanilla solution won in both areas. And I say that as an FP and Haskell fan boy.
In the end the vanilla solution won in both areas. And I say that as an FP and Haskell fan boy.
Edit. For some reason people equate "functional" with Haskell, even though Javascript (and most modern languages) is perfectly capable of expressing functional idioms without the descent into madness.
Your vanilla solution is already a functional solution. Literally no need for `transduce pipe map over lens`
Except of course deep recursion, which needs to be rewritten into a not so readable externalized stack or some kind of loop replacement. There are difficulties involved with rewriting some recursions as loops and some loops as recursion.
Of course, if JS engines adhered to the standard, they would all have TCO by now and the problem would not exist.
No idea what your comment about jack shit is about. Haskell is often just as bad as Ramda.
Edit. By the way. All the unusable and unreadable jargon that Haskell uses can be much more easily explained with Javascript: https://github.com/hemanth/functional-programming-jargon Make of it what you will
As you can see even in the blog post: straightforward readable code using built-in functionality is turned into 8-12 imports, a bunch of auxillary functions and multiple function calls that obscure the actual functionality. At 35 times speed penalty and 2 times memory penalty.
JS simply does not lend itself to currying, data-last signatures, piping, and pattern matching like an ML family language does. And as you can tell by the Ramda typings, neither does the TS type system. [0]
You will forever fight an uphill battle against every single tutorial and piece of documentation and colleague when going down this path. I don't think the effort is worth it.
0 - https://github.com/DefinitelyTyped/DefinitelyTyped/blob/dc9b...
https://github.com/tc39/proposal-pipeline-operator https://github.com/tc39/proposal-pattern-matching
In contrast, take the recently stage-3'd Iterator Helpers[0]. These build on top of the language by using methods that already exists in other parts. It feels natural and is more of the same.
0 - https://github.com/tc39/proposal-iterator-helpers#implementa...