The Scala Specialists

Know Your Scala


Books, videos, training, and mentoring... everything you need to excel.

Browse our catalogue

Succeed With Scala


Professional services tailored to your business, whatever stage you're at.

Work with us

Latest from the Blog

Deriving the Free Monad

The free monad is defined by this structure1:

sealed trait Free[F[_], A]
final case class Return[F[_], A](a: A) extends Free[F, A]
final case class Suspend[F[_], A](s: F[Free[F, A]]) extends Free[F, A]

We can use the free monad without understanding its implementation, but to really understand it we need to know why it is defined this way.

It certainly wasn’t obvious to me why this is the correct definition, and reading the literature quickly devolved into “doughnoids in the category of pretzelmorphisms” land. Here I want to present an explanation aimed at programmers that doesn’t involve abstract alphabet-soup.

  1. There are other ways of defining the free monad, but this is the most common in my reading.

Continue reading…

RxLift: Reactive Web Components with LiftWeb and RxScala


LiftWeb makes building dynamic websites extremely easy whilst hiding away a lot of the plumbing. RxScala is a Scala adaptor for RxJava, “a library for composing asynchronous and event-based programs using observable sequences for the Java VM”.

This blog describes how we combined Lift and RxScala for event-based UI components consuming and producing observable sequences.

Continue reading…

Newsletter 7: Error Handling and Two New Books


Let’s talk about when things go wrong. It, inevitably, happens and every program needs an error handling strategy. The right strategy depends on the context – a throwaway script might not even need to handle errors – but the tasks for which Scala is typically used demand a robust approach.

In our code reviews we often see ad-hoc approaches to error handling that rely too much on people remembering to do the right thing. Last month we ran a mini-series on this topic on the blog, presenting some intermediate-level techniques that you can apply to make your code more robust.

Continue reading…

Our Customers

Some of our happy customers: