These are chat archives for ramda/ramda

17th
Jun 2018
Mike Lambert
@lax4mike
Jun 17 2018 00:56
For monads, check out crocks
Renato Marinho
@renatomarinho
Jun 17 2018 10:00
This message was deleted
c50a326
@c50a326
Jun 17 2018 10:50
hey is there something I can do with ramda to handle websocket events (both in the client, in the browser, well I'm using React, and also I'm running a server with Node.js too, using the ws package)
Frédéric Mascaro
@wooandoo
Jun 17 2018 12:26
I have a similar question above. I feel like we have to be interested in monads: IO, Either, State?
And yes, crocks seems to be a powerfull framework.
Brad Compton (he/him)
@Bradcomp
Jun 17 2018 17:32

You can go years just using Ramda without getting into the ADTs. Initially, it helps to just break up your codebase into small functions, then using stuff like compose and reduce to combine the pieces as necessary.

It helps to separate out your domain specific code from code that operates on structures (map being a good example of the latter). You’ll find that there are lot of patterns involved in, e.g. creating a handler, that you can abstract into functions that don’t need to understand anything about the domain you’re dealing with.

Eventually you’ll find that certain patterns could become easier if you just could encode some of your information into the types you are using.

A lot of people like using Either to handle errors, but it is great for any type of conditional logic, as well as short circuiting computations. Likewise, Reader can be used to inject configuration into your app, similar to Dependency injection but much simpler.

Because these things are all Monads, a lot of your structural code can now operate on any of them without having to change any code