Playing "Type Tetris"

I’m going to try to explain a technique called type-driven development. It’s where we write as much code as possible using only types, deferring any non-type details until later. We’ll see how it helps us as we develop a small service that supports authentication. Along the way we’ll see how we can use abstract types, the ??? method, and the Scala compiler itself to converge towards a good solution to our task.

Since type-driven development doesn’t sound very fun, I like to call it “Type Tetris”. How is programming with (only) types like Tetris?

Continue reading…

The Free Monad with Multiple Algebras

In this post I will look at the machinery that makes it possible to use Free with more than one algebra at once: Coproducts and the Inject type class. This technique was first described in the paper Data types à la carte, and Cats and other libraries provide implementations. However we’re going to build our own implementation in this post, so we understand how it all works. I’m going to assume you understand Free at a basic level. If not, there are several good posts that introduce the concept.

Continue reading…

Refining your data from configuration to database

One of the promises of strongly typed languages is that the compiler will catch your errors instead of throwing unexpected exceptions at runtime. In this post we will cover all stages of an application from model, user input, configuration, and database, seeing how far one can take this approach without hitting a ‘diminishing returns’ wall.

Continue reading…

Finch: Functional Web Development

A considerable number of Scala developers are attracted by the promises of type safety and functional programming in Scala, as can be seen by the adoption of libraries like Cats and Shapeless. When building an HTTP API, the choices for a pure functional programming approach are limited. Finch is a good candidate to fill that space and provide a full-stack FP experience.

Continue reading…

Newsletter 15: New Events in the New Year


At the end of last year we ran a Christmas sale to raise money for charity. In this edition we have the results of that sale, and also the details of three events we’re running in the upcoming months, in LA and Seattle.

Continue reading…

Older posts