We’ve talked about monads quite a lot on Rock the JVM. In this article, we’ll approach them from yet another angle.
Posts by Year
Apache Kafka has proven itself as a reliable and scalable communication bus between distributed application components. We’ll learn to use ZIO to interact wi...
Referential transparency is your best tool for productivity as a functional programmer in Scala. In this article, we’ll talk about what it is and why it’s im...
In this article, I’ll show you how you can exploit the implicit resolution mechanism in Scala to enforce type relationships at compile time.
Showing a Scala 3 trick that few developers know: exploiting the absence of a given instance to enforce type relationships.
Many libraries implement the effect pattern in the Scala ecosystem, and every one has its own concurrency model. First, let’s introduce the ZIO library and i...
Once we learned the basics of functional programming, it’s time to understand how to use them to expose APIs over an HTTP channel. If we know the Cats ecosys...
Cats is a complex library for Scala. In this article, we’ll deconstruct the major type classes of Cats and explain how they’re connected.
In this article, we’ll go through the major testing styles with Scala and ScalaTest, and we’ll understand what ‘FunSuite’, ‘FlatSpec’ etc mean.
A short article with a powerful idea about functional collections many Scala programmers do not know about.
After the previous introduction to concurrency in Cats Effect, we’ll look at how to manage racing IOs and fibers.
A quick dive into asynchronous computations with fibers in Cats Effect 3, written for Scala 3.
Deconstructing extension methods, one of the most exciting features of the upcoming Scala 3.
What’s the problem?
This quick article will show you how given instances in Scala 3 can work with Scala 2’s implicits.
In this article we’ll see a good practice for organizing code, messages, domains and logic in an Akka application with Scala.
This article is about Monoids and Semigroups as a gentle introduction to functional abstractions and to how the Cats library works.
Learn how to approach a Google-style algorithm interview question in Scala with pure functional programming.
ZIO layers (ZLayers) help us structure our complex services into modules that are independent, composable and easy to understand. Let’s take a look.
An ad-hoc type definition technique for eliminating bugs which are hard to trace, with implementations in Scala 2 via newtypes and in Scala 3 via opaque types.
Although frowned upon by FP purists, creating and managing mutable data structures is important in any language. Scala has some first-class features.
Error handling is likely one of the most frustrating part of programming, and in Scala, there are better and worse ways to do it. Let’s take a look.
Scala 3 comes with lots of new features. In this episode, match types: a pattern matching on types, and a tool for more accurate type checking.
Sorting lists might be a “school” problem, but in this article I’ll show you how to use proper FP, tail recursion and more, using this popular example. Might...
Every developer using Scala meets the acronym ADT sooner or later. In this article, we will try to answer all of your questions about ADTs.
This article is for the starting Scala programmer: an introduction to singleton objects and companions in Scala, what they can do, and why and where we shoul...
In this article, we’ll explore one of the most used (and useful) concepts in pure functional programming: the Functor. Pretty abstract, so buckle up.
In this article I’ll wrap 2020 and share a few insights, achievements and changes, and I’ll project some plans for the future of Rock the JVM.
I’ll show you a technique to use lazy values and call-by-name for recursive value definitions and implement a fully immutable doubly-linked list in Scala.
This quick tutorial will show you what dependent types are and how they work in Scala 3, along with dependent methods and functions.
From the previous article, you know how givens work. Let’s compare them with the old Scala implicits.
The given/using clauses are some of the most important features of Scala 3. Read on for the essential concepts and how to use them.”
We’ll take a look at the famous “covariant type occurs in contravariant position” problem, and what we can do about it.
A quick article on one of the simple, but expressive features of the Scala 3 method syntax.
Some people love it, some hate it. Scala 3 indented syntax is not that bad, and it might actually help. Let’s take a look at how Scala 3 can change the struc...
Akka Typed has not only made fundamental changes in the actor protocol definitions, but made significant improvements in actor mechanics as well.
Akka Typed has fundamentally changed the way we create actors. In this article we’ll look at several ways we can keep state inside Akka actors.
It’s obvious that Spark allows us to join tables. What’s not obvious is how many different kinds of joins Spark supports. We explore them in this article.
Broadcast joins in Apache Spark are one of the most bang-for-the-buck techniques for optimizing speed and avoiding memory issues. Let’s take a look.
Exploring a quick but powerful structure in Scala 3 - type lambdas. This will help you think higher-level.
Scala has a powerful type system. We look at how Scala types can be organized, what type constructors are, and why we should care.
We discover opaque type aliases in Scala 3 and how we can define new types with zero overhead.
This article will continue some of the previous explorations of Scala 3. Here, we’ll discuss some of the new functionality of traits in Scala 3.
Scala 3 introduces enums. About time! Even though it might seem like something minor, it has important implications.
Scala 3 introduces some new kinds of types, which we’re eagerly awaiting for.
A really nice way to inspect, extract and modify deeply nested data structures in Scala.
Akka HTTP needs JSON like humans need water. We show you how to integrate Spray-Json, Circe and Jackson into Akka HTTP.
Scala code is super easy to deploy to AWS lambda. We show you how in this step by step tutorial.
We look at how we can impose constraints on values at compile time with the Refined library.
Scala syntax is so confusing sometimes - I’ll show almost all uses of underscores in Scala. Sometimes the philosophy is inconsistent, but it’s worth at least...
Drawing the line between two fundamental repartitioning operations in Apache Spark.
We explore some not-so-well-understood territory in the form of eta-expansion and how methods and functions interoperate.
Final blow in the type-level trilogy. We learn how to sort lists… at compile time.
We continue down the path of type-level power in Scala. We learn to add numbers as types, at compile time.
This one is hardcode. We make the Scala compiler infer type relationships for us at compile time. Pure power.
Abstract classes and traits share a lot of overlap in Scala. How are they actually different?
Various constructions like “20.seconds” look like baked into the Scala language. Let’s see how these work.
We explore the various flavors of nothing-ness in Scala.
Akka Streams has the Graph DSL, which is one of its most powerful APIs. Learn how to use it and get started quickly with Akka Streams.
We compare three of the most popular streaming libraries and see where Akka Streams, Kafka Streams and Spark Streaming are most useful.
FP fans talk about pure functional programming in Scala with type classes. They’re hard. Why do we really need them?
Akka HTTP is super easy to deploy to a web server. Learn how to use Heroku and deploy your first Akka HTTP service in minutes.
A Scala tutorial on Monads that makes no assumptions and starts from practical needs. We derive the monad patterns (“laws”) from scratch.
Scala is an amazingly expressive language, but even the most experienced devs aren’t aware of all the subtleties.
Yep, you can write your own interpolator that looks like it was built into the Scala language. Learn how.
Akka Typed is one of the best things that happened with the Akka API. We explore how good practices are baked into the API directly.
We discuss the tradeoffs between 3 different styles of writing parallel code, in terms of thread use (and other effects) in Scala and Akka.
Learn to read files in Scala like a boss and compare it to other styles in other languages. We write a simple API which looks almost as easy as Python’s read...
Maximize the call-by-name semantics in Scala and manipulate your results when you want them.
We walk you through one of the foundational skills for Spark performance optimization: reading the Spark UI and the graph of how your job is structured.
We go on a short trip to Nothing (and nothing-ness) in Scala. Nothing is actually pretty useful.
Daniel goes into another rant about learning (and teaching) Scala using loops. Are they actually useful?
We demystify one of the hardest concepts in Akka Streams: materialized values.
In this article you’ll learn one of the most important Spark skill: reading how your job will run. This is foundational to any further Spark optimization.
Daniel goes into a small rant about learning (and teaching) Scala using variables.
For OO programmers looking to dive into functional programming in Scala: a gentle introduction to functions working with other functions.
In this article we learn to address the problem of “deterministic” Futures in Scala, using Promises.
Self types are a really interesting way to enforce type constraints in Scala. Learn to use it in a few minutes.
Learn to use Akka HTTP with Scala and send HTTP requests in just a few minutes with the Akka HTTP server DSL.
The Scala type system is powerful, but also hard. We look at contravariance in Scala and try to make some sense out of it.
Pattern matching is one of the most powerful Scala features. Learn to use it to the max so you can write your best Scala code.