Category of C++ Types

In the first installment of "Category theory for programmers", Bartosz Milewski introduces a particular category in which objects and morphisms are thought as C++ values and C++ functions, respectively. Instead, let us try to delineate the category in which objects are C++ types. In such a category, morphisms are metafunctions…

Fail-fast vs. fail-slow composition

Composing effectful operations can be of many types. If you want fail-fast composition, then you need to go for monadic ones. You can have each of your functions return the monad of your choice (e.g., Either). Then you can use for-comprehensions to compose them. If you want to have…

Promises are functional

callback-based functions do not return anything, and so are hard to compose. A function with no return value is executed only for its side effects – a function with no return value or side effects is simply a black hole. So programming with callbacks is inherently imperative, it is about sequencing…