The perfect API

Imagine for a second that everything had the same interface. Everything. If this API is going to handle every situation, its surface area can't be used conditionally. E.g. we don't use certain parts for certain problem domains. Every part must be useful for every problem domain. It sounds like…

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…

The Functor pattern

Also Functional programming has its own set of patterns (with more cryptic names w.r.t. OOP's patterns; such as Functor, Monoid and Monad). Here's a nice introduction (in C++11) to the Functor pattern by Bartosz Milewski.…