An algebra is just a type τ with some functions and identities. These functions take differing numbers of arguments of type τ and produce a τ; uncurried, they all look like (τ, τ,…, τ) → τ. They can also have "identities"—elements of τ that have special behavior with some of…

# Algebraic patterns - Semigroup

Given three puzzle pieces, these can be put together in two different ways, starting by combining the first and second, or staring with the second and third. Either way the final result is required to be the same. This means solving a puzzle is easily parallelizable. Rest of the article…

# 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…

# Separating state and behavior

With an ADT you can enforce strict separation of algebra & interpretation (D. Ghosh)…