Menu

Algebraic API Design - Types, Functions, Properties

In this post we are going to explore the concept of algebraic API design which is based on types, pure functions, and the relationships between them known as domain rules or properties. We will do this based on a complete, self-contained example using Cats and Cats Effect and walk through...

Cats Ecosystem Community Survey 2018 Results

Overall we received 588 responses over the course of 30 days. This feedback is essential for us to make informed decisions on our 2019 plan. Thank you, everyone, who participated. As promised, here are the results, as well as some quick reads from us. Q: How long have you been...

Error handling in Http4s with classy optics – Part 2

This is a continuation of my previous blog post. Make sure you have read that one before continuing here. I recently gave a 20 minutes talk on classy optics at the unconference of Scale by the Bay where I also talked about this error handling technique and on my way...

A tale on Semirings

Ever wondered why sum types are called sum types? Or maybe you’ve always wondered why the <*> operator uses exactly these symbols? And what do these things have to do with Semirings? Read this article and find out! Most of us know and use Monoids and Semigroups. They’re super useful...

A comprehensive introduction to Cats-mtl

MTL is a library for composing monad transformers and making it easier to work with nested monad transformer stacks. It originates from the land of Haskell, but has made it into Scala a long time ago. For the longest time however, it was barely usable, because of a bunch of...

Variance of Monad Transformers

A question that repeatedly pops up about Cats is why monad transformer types like OptionT and EitherT aren’t covariant like their Option and Either counterparts. This blog post aims to answer that question. Covariance What does it mean to say that Option is covariant? It means that an Option[B] is...

Chain – Replacing the List Monoid

List is a great data type, it is very simple and easy to understand. It has very low overhead for the most important functions such as fold and map and also supports prepending a single element in constant time. Traversing a data structure with something like Writer[List[Log], A] or ValidatedNel[Error,...

Error handling in Http4s with classy optics

As a longtime http4s user I keep on learning new things and I’m always trying to come up with the best practices for writing http applications. This time I want to talk about my latest achievements in error handling within the context of an http application where it basically means...

Refactoring with Monads

I was recently cleaning up some Scala code I’d written a few months ago when I realized I had been structuring code in a very confusing way for a very long time. At work, we’ve been trying to untangle the knots of code that get written by different authors at...

Testing in the wild

Writing tests seems like a wonderful idea in theory but real systems can be a real pain to test. Today I want to show a few tips on how to use specs2 + ScalaCheck to make some real-world testing somewhat bearable. I am currently refactoring a big piece of code....