Modern day javascript environments have many ways of dealing with state. One can use closures or classes to have some shared state, but sometimes a more elaborate state management library is needed…
As functional programmers, we like to piece our programs together out of small pieces. Our main tool for this is composition. We take an input, process it through a function, then pass it on to another function. And this all works great so long as all our functions take exactly one argument. Which never happens. So what do we do? In general, we turn to a set of tools called combinators. This article focusses on a particular combinator called the blackbird.
In a previous article, I introduced a neat little pattern I use to leverage Promise.then() so that I can compose both synchronous and asynchronous functions together into a sort of sequential…