Found this new (to me) FP library called Sanctuary.
It has total functions; unlike Ramda/Lodash it validates types at runtime; no need to check for the correct data type before using functions.
It makes intelligent decisions around results being ADT’s. You get back a Maybe for things in Lodash that would report a String or undefined. A lot more clear and something you’d end up probably wrapping yourself anyway.
Currying: Only 1 Arg Per Function
add(1, 2, 3) vs
add(1)(2)(3) helps them out a lot to learn.
Throws For Wrong Type
This kind of makes me rage is what they call invariants. Meaning, if you pass in the wrong type, it throws. Now, during unit testing + manual testing at runtime, this can help suss out bugs even if you’re using typings via Flow/TypeScript, etc. However, throwing Errors is a side effect, and it blows my mind a group smart enough to create Sanctuary would do this. Good news, tho, you can turn it off, heh!
Read more about Sanctuary.
I’ve been doing Node full-time at work and noticed a lot of other people lacking a centralized resource to get up and running quickly. There are a lot of wonderful resources out there for Node, a Google search away, but hopefully this document should get you coding quickly as well as able to communicate effectively with other Node developers.
I’ve tried to write this list in order of most important things you need to know. Feel free to skip around.
Continue reading “Node.js Crash Course”
tl;dr; First option is to create Promises that only call success with an Either, and Promise.resolve in the catch with an Either, or second option is to use a simple wrapper function.
Continue reading “Easier Error Handling Using Async/Await”
Continue reading “Asynchronous Programming”