I am happy to announce that I host my new blog at https://rvarago.github.io.

TL;DR: I have started my new blog at https://rvarago.github.io.

I have already exported all my posts from Medium to https://rvarago.github.io. Further, during the process, I had the chance of polishing and updating them with, hopefully, better explanations.

I surely will keep the content that I already have at Medium available and intact. Moreover, I may mirror futures posts from https://rvarago.github.io to Medium, eventually.

I will look forward to feedback on the new blog. Please, come to say “Hi!”.

See you all there! :-).


Cross-compiling C++: x86–64/Linux -> ARMv7/Linux.

Cross-compilation has a huge impact on the development of cross-platform C++ embedded software. Therefore we have plenty of tools to help us, and dockcross is one of them, which we will briefly discuss.

Software that executes on a different platform than the one we used to write it has to be cross-compiled.

When we refer to “compiling”, we usually mean the act of converting our source-code into a representation that the machine understands, ultimately a bunch of zeros and ones.

Often, we execute our program on an equivalent platform to the one we used to write and compile it. Say…


For once, let’s try to haunt bugs rather than be haunted by them 🐛.

Phantom types are useful to encode information about how and where values are supposed to be used, which can catch a class of bugs early.

In programming, we frequently implement protocols that our building blocks are supposed to follow, e.g. if x, then y, otherwise z. We are sequencing a series of operations and each operation may depend on the application’s current state.

Sometimes the protocol is implicit in our head, and we don’t make assumptions as explicit and formal in the code as they are in reality.

A protocol might also vary in complexity, ranging from a straightforward read…


An enterprise Gopher with a tie and long beard ready to fight bugs alongside you. Gopherize.me

Testing is an important aspect of software development. Let’s see how Property-based Testing can help us to test our Go programs.

A few weeks ago, I gave a talk about Property-based Testing using Golang on our awesome Engineering Summit 2020 @ eGym, which I tidied up, included more details and now I want to share with you in this blog post.

Programming is an activity carried out by humans, and hence prone to mistakes. Mistakes can happen and sporadically they do.

However, as professionals, we have techniques, practices, and tools that help us to catch mistakes as early as possible…


That’s the question! How about a composition of both? 😉

Algebraic Data Types bring us yet another interesting way to express concepts in code, let’s see how they could help.

Programming is about composition. We usually tackle a hard problem by breaking it up into smaller and more easily comprehensible tasks, that are then composed together, be it functions, objects, etc.

Along the way, interesting challenges arise, when we are introducing new types to express a concept in our code, be it concrete or abstract. And that’s precisely the topic that we are going to discuss a little bit. But before we start, please notice that there are quite a…


An introduction to the C++ library absent.

I have created a small C++ library called absent: https://github.com/rvarago/absent inspired by functional programming languages, e.g. Haskell and Scala, whose purpose is to simplify the functional composition of nullable types, such as, but not limited to, std::optional.

It offers some useful combinators, for instance, bind, fmap, eval, alongside an infix notation based on operator overloading, that aim to reduce boilerplate from our daily C++ code while increasing its type-safety and expressiveness.

One of its main purposes is to refactor this kind of code snippet:

auto const maybe_person = find_person();
if (!maybe_person) return;

auto const maybe_address…

Don’t you agree that λ is a very stylish letter? 🆒

How to use the glorious expression-oriented to handle object instantiation based on conditions without giving up immutability.

Functional Programming (FP), or more generally Declarative Programming, encourages writing programs by composing expressions rather than statements that mutate state as we usually do in Imperative Programming.

Let’s take a look at how we can benefit from this idea in our codebase even if it doesn’t completely adhere to FP.

Expressions, statements… What?? 😕

Roughly speaking, an expression is a piece of code that can be evaluated to result in a value. Whereas a statement is an action to be carried out.

Some examples of expressions in…


😱 Trust me, it’s not as scary as it looks.

And the advantages of writing APIs that don’t lie to us.

Okay, the title might sound fancy, I must acknowledge that. But I have to tell, I really love total functions. It might sound super complicated, but the truth is: it’s reasonably simple. And once followed, it can simplify our lives a lot. It’s definitely not 🚀 science at all.

In this article, I’m going to use C++, but the same principles apply regardless of the programming language you may happen to be using. …


It’s been fairly common to find talks and articles about algebraic data types, things like sum and product types are becoming popular in mainstream programming languages nowadays. So let’s try to understand what they are about.

Disclaimer: This post is a brief introduction to the topic from a Software Engineering’s perspective, given that I’m a Software Engineer and not a Mathematician. Therefore I’ll avoid deepening too much in the Mathematics behind it. However, I strongly encourage you to dig deeper into the topic, especially in Category Theory. …


CMake Icon. Source: https://commons.wikimedia.org/wiki/File:Cmake.svg

Some advice to help you when porting a build system based on CMake to use a modular approach following the so-called Modern CMake.

Abuild system isn’t the easiest part of a Software Engineering project. On a high-level analysis, the build system describes the project, its content and more critically: how project modules are related to each other.

In the end, you have a well-known data structure named graph, specifically a directed graph. …

Rafael Varago

Software Engineer interested in C++, Rust, Haskell, Scala, Go, C, Python , Linux, functional programming, system programming, tooling, IoT, cloud, math, etc.

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