4 ms·
I feel like TypeScript needs some work in areas around typing methods - for example, I ran into type issues when trying to go more functional via ramda.js (http
by Bahamut 10y ago
I feel like TypeScript needs some work in areas around typing methods - for example, I ran into type issues when trying to go more functional via ramda.js (http://ramdajs.com/ http://ramdajs.com/) using stuff like compose, and ultimately it felt like a limitation of TypeScript.
- Roboprog 10y agoRamda is pretty cool. It's also a really good introduction to use-cases for partial function application ("currying"), vs silly "adder" examples. (think of partial function application as dependency injection for FP)
- spion 10y agoTo properly type Ramda, you need higher kinded types, which are not yet a feature of TypeScript. Though I find that Ramda's curried style isn't that useful now that we have arrow functions...
- Roboprog 10y agoHmm. I find that classes and subclasses aren't all that useful, now that I can use higher order functions :-) (I still use classes/objects for services with multiple related operations or polymorphism, but not for one trick pony "Executioners" for which Java would use a lambda -- which is what ES6 arrow funcs look like) I wish I could vote the grandparent post up more.
- spion 10y agoWhat I meant is that pointfree style (which is what Ramda implements) isn't that great in JS: * JavaScript is not suited for it (no composition operator, no interop with existing multi-argument functions) * It doesn't improve readability over arrow syntax. compose(f, flip(g)(y), h) vs x => f(g(h(x), y))