In Scala, unlike for example Haskell, a monad is just a concept — there is no superclass called Monad from which all monads inherit. A monad, basically, is any wrapper class which has a static method, unit (note: this is a popular name for the method; it’s not the…


Another idea you may already know but not associate with functional programming is that of an expression — as opposed to a statement. When writing code in the imperative style we build functions with statements. It’s how we order the program to do something: get data from here, modify…


Or at least we will talk today about one of a few ways to do it. If you want to learn more about what is possible, and why it might be a good idea to consider an alternative to standard Android app development, please take a look a look at…


CODEX

The simple answer to how immutability helps with thread safety is — basically the same as with laziness. If data does not change it means that any number of threads can access it at any moment and they don’t mess with each other. But of course, the whole point…


This is a blog post made from a transcription of a conference talk I gave at ScalaLove in February 2021. A link to the video will be added when the video from the conference is published.

For four years now I develop…


Try

In the previous episode we talked about Option and Either and how we can use them to avoid throwing exceptions. But much more often than throwing exceptions, we receive them from third-party libraries and try to handle them with try/catch clauses. …


Alexei Navalny

We were friends for the last four years. We are no more. But it does not mean we can’t be again.

Yes, I saw those videos of Alexei Navalny from years ago, where he compares immigrants to a rotting tooth. I didn’t like it. I also know his views about…


I decided to write this article because I remember that back when I started to learn Scala around 2013–2014 the problem of how to return early from a loop actually happened to me a few times. I had a collection which I wanted to go through looking for the first…


One very cool thing about programming with functions is that data we work on does not have to be mutable so often. In theory — and languages like Haskell — it’s possible to never use mutability, but the alternative solutions can sometimes be pretty complicated or at least very…


The unapply method

You can think of the unapply method as the opposite of apply... d’oh. Say, you have that sealed trait Cat and its companion object. There are two apply methods defined: they take the colour of the cat (or its lack of colour, so to say) and create a cat…

Maciek Gorywoda

Scala. Rust. Bicycles. Trying to mix kickboxing with aikido. Trying to be a better person too. Similar results in both cases. 🇪🇺 🇵🇱

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store