These are chat archives for ramda/ramda

20th
Feb 2019
Rakesh Pai
@rakeshpai
Feb 20 04:31
There seems to a strong trend towards TypeScript. ref: Laurie Voss sharing npm data on this podcast says that 60+% npm users are indirectly using TS (dependencies, maybe), and 30+% users are using TS directly as of 2018, which is a significant increase from the previous year. However, TS falls sort of what would be needed to work well with Ramda. Unfortunately, this means we have to choose between TS and Ramda. I wish we didn't have to make that choice. :(
I guess the benefits of TS are clear - it definitely catches a certain class of bugs early. We could debate the relative importance of that vs the benefits we get with FP. But as team sizes grow, and we have people with different levels of experience and expertise, I'd suggest that any system that can help catch errors early is useful. So, TS really starts to shine in larger teams. But I think FP also really shines in large teams, and again, I wish we didn't have to choose.
Rakesh Pai
@rakeshpai
Feb 20 04:37
Thoughts? How are you folks dealing with this? There's significant peer/org/business/quality pressure to use TS, and it's not clear if it's a step forward or a step back.
Brad Compton (he/him)
@Bradcomp
Feb 20 17:30
Personally, I haven't seen enough benefit to using TS that it would be worth dropping my FP practices for.
Brad Compton (he/him)
@Bradcomp
Feb 20 17:35
I recently read this article on the subject, and I agree with it: https://medium.com/javascript-scene/the-typescript-tax-132ff4cb175b
Ben Briggs
@ben-eb
Feb 20 18:46

This article sums up my feelings on the subject:

Instead of arguing about untyped vs typed, a non-existent distinction, we should accept that all programs have invariants that must be obeyed, i.e., all programs are typed

https://www.williamjbowman.com/blog/2018/01/19/untyped-programs-don-t-exist/

Static typing is one means of defining your invariants but it's not the only way
Ben Briggs
@ben-eb
Feb 20 18:52
Another way may be to use property based testing, which may capture a whole other class of bugs that static typing won't give you
Brad Compton (he/him)
@Bradcomp
Feb 20 19:24
I like PBT a lot, even as just a means of thinking about your programs
Ben Briggs
@ben-eb
Feb 20 19:29
@Bradcomp Yeah, definitely. It can help to reduce bias that can creep in through manually written tests
Brad Compton (he/him)
@Bradcomp
Feb 20 19:30
For me, the fact that one can't properly represent HKTs like Monad is a big issue. I know lots of people consider them esoteric, but they can be really helpful in actually preventing error classes that are a superset of the ones caught by Typescript. I get way more benefit there from what I am losing
Ben Briggs
@ben-eb
Feb 20 19:43
I'm still not quite there with monads in js. I get the concept of them but I don't know if adding them to the codebase makes it more difficult to understand
There was one case where I was using an either monad because the semantics of "got all values, don't continue (left)" and "still need to get more values (right)" really made sense in that particular area of the code. But it was an exception to the norm
Brad Compton (he/him)
@Bradcomp
Feb 20 19:51
I think Maybe is really nice
It forces you to deal with missing data, without having to add in null checks everywhere
Ben Briggs
@ben-eb
Feb 20 19:53
Yeah I find I do unless(isNil, () => ... ) a lot
Brad Compton (he/him)
@Bradcomp
Feb 20 19:53
stuff like Either and its descendants can really reduce the amount of branching in one's codebase
Ben Briggs
@ben-eb
Feb 20 19:54
(so much so it's now a util file :) )
Brad Compton (he/him)
@Bradcomp
Feb 20 19:55
I think there is a learning curve, and it isn't always necessary, but if one is arguing the benefits of static types it's helpful to consider that there are alternate and more flexible ways to achieve that safety
Ben Briggs
@ben-eb
Feb 20 20:03
Yep. :)
I think I can get away without TS in large part due to the JS code sitting behind a GraphQL endpoint, so I get type safety there
But third party APIs are not always so clean :wink:
Markus
@evdama
Feb 20 20:30
what am I missing... one can't use TS and Ramda together?
there are typings
@rakeshpai why would you have to choose one or the other? use both
Brad Compton (he/him)
@Bradcomp
Feb 20 20:32
There are a lot of issues that arise because the typings don't capture the 'real' types of the Ramda functions
either they are too restrictive (e.g. only work on 'list' instead of 'functor') or else just use any because it can't capture the actual type
Markus
@evdama
Feb 20 20:33
and there I was planning on starting to use Ramda on my next project (which will be TS)
Brad Compton (he/him)
@Bradcomp
Feb 20 20:34
Feel free, just be aware that there have been complaints about the typing
Markus
@evdama
Feb 20 20:35
well, the question is, am I going to run into issue using ordinary ramda functions such as R.prop or do those issues just arise when I go deeper into FP land and start to play around with fantasy land stuff?
evdama @evdama checks
Markus
@evdama
Feb 20 20:37
Ramda for me is a great utility belt as of now... I'm not so much interested in the academic angle of FP
I do love how elegant Ramda functions solve everyday problems though
Brad Compton (he/him)
@Bradcomp
Feb 20 20:38
I do too ;)
Brad Compton (he/him)
@Bradcomp
Feb 20 20:38
It isn't a hard no, just poke around some of the issues
Markus
@evdama
Feb 20 20:39
roger that, will do, I thought it sounded like TS and Ramda are a no go which would be sad
because then I'd have to decide for TS
but they're both so awesome :)
Brad Compton (he/him)
@Bradcomp
Feb 20 20:40
Yeah... It's not a no go, just most of us don't use TS.
Markus
@evdama
Feb 20 20:40
but then you should
I didn't care at all at first
now, one year later, can't do without it
intellisense alone is worth it
switched to vscode as well
after years on webstorm
emacs before that
evdama @evdama switched IDEs every 7 or so years ;)
Brad Compton (he/him)
@Bradcomp
Feb 20 20:43
I used TS in production for 6 months extensively, didn't like it at all
but that's just me
Markus
@evdama
Feb 20 20:43
fair enough :)
good thing about ts is that you can opt in gradually
2019... they year when I'm going to start using ramda and rxjs extensively :-)
Brad Compton (he/him)
@Bradcomp
Feb 20 20:46
:+1:
Markus
@evdama
Feb 20 20:46
and react hooks of course ;)
Brad Compton (he/him)
@Bradcomp
Feb 20 20:48
I was years on webstorm as well... I liked it a lot. Finally made the switch to vim full time in January. I get decent JS IDE experience from a bunch of plugins - tern, node-vim, supertab, ALE, etc...
Markus
@evdama
Feb 20 20:49
ok, to me emacs/webstorm/vim... they're all kinda old tech compared to vscode
these days imho it's not so much about plugins but about intellisense and CD integration
github actions for example... can't wait to start using it and do CD right into firebase
PRs and stuff all taken care of programatically with github actions
which tie nicely into vscode
and yes, it has plugins too :)