flatMap(Oslo) 2018
3-4 May 2018, Oslo Norway

Regaining Control with State Monad and Friends


A state transition can be modeled as a simple function:

type State[S, A] = S => (S, A)

In this talk we’ll see how indexed monads like the State Monad are built around this simple concept.

From side-effect free state modification to Finite State Machines. The State Monad is immensely useful and actually - as will be shown throughout this talk, definitely, not scary at all.

We’ll get comfortable with the state monad from the Cats library, and learn how we can write functional APIs that describe state transition on the type level using indexed monads.

Felix Mulder

Felix Mulder


Former Compiler Engineer at LAMP, EPFL. Building the next generation Scala compiler - Dotty. Currently lambda head at Klarna in Stockholm, building purely functional things in Scala.