Introduction to Monads With Scala 3

So, you are trying to grasp the concept of monads. If you are learning functional programming, understanding monads is a kind of rite of passage. Looking for monads on Google can be a bit daunting. The concept comes from category theory, so there are a lot of explanations starting from there. However, in this tutorial we are staying away from category theory and addressing them from the developer’s point of view.

Continue Reading

What are Effect System and Why Do We care?

If you are new to functional programming in Scala, you probably have encountered libraries like cats-effect and ZIO. If you are attentive to the news in the Scala ecosystem, you have also heard that there is even a new kid on the block in the effect system neighbourhood, Kyo. What are they and why do we need them? In this post, we are digging into that question.

Introduction

If you go to the cats-effect website it reads: “The pure asynchronous runtime for Scala”, the zio web site states “Type-safe, composable asynchronous and concurrent programming for Scala”.

Continue Reading

Tutorial: Basic Full Stack App With Scala 3

The goal of this tutorial is to setup a fullstack app in Scala 3. The idea of this tutorial is to learn and understand the different pieces needed for a fullstack app in Scala. Thus, we are going through each step and explaining our every choice. We also link to relevant documentation.

There are several components that you will need to have your fullstack app:

  • a server that provides web services that are the backend of our app
  • a client that works in the browser and provides a UI for the user and communicates with the backend

The architecture is simple, but we also need some supporting infrastructure:

Continue Reading

Introduction to Functors With Scala 3

You’ve recently started learning functional programming and have been successful in writing functions, but then something unexpected happens. A wild functor appears! What is that? Why is it here?

Don’t be scared, functors are a mathematical structure that arises from category theory, and they can be found everywhere in functional programming. For those of you who don’t know category theory, this will give you enough knowledge to understand functors and use them to program.

Continue Reading

ADTs in Scala (Part 2: ADTs vs OO-Classes)

In my latest post I presented ADTs in Scala 3. I also created a Youtube video about it (check it out here). Since the content was longer, I split it in three parts. This is the second part.

We look at the differences between classes and ADTs. We discuss:

  • Immutability
  • Inheritance
  • Public and private fields
  • Methods
  • Pattern matching

This video is an introduction to ADTs in Scala for object-oriented developers. We look at the differences and show examples of how to change values in ADTs, how methods work and pattern matching.

Continue Reading