What Is a Monad? Basic Theory for a Java Developer

As you can guess from the title, the main topic of this article will be monads. I will try to dive deep in their structure and inner workings. With some help of Java Optional, I will try to describe all of this in a more detailed way. At the end of this article, I will implement a log monad — a type of a writer monad —and then describe the role of each major code fragment and provide a simple example of its usage.

Why Learn How Monads Work?

First of all, it is always good to have a basic understanding of how things that we use work. If you are a Java developer, you probably use monads without even knowing about it. It may surprise you, but two of the most commonly known Java 8 features are monad implementations, namely Stream and Optional. In addition, functional programming becomes more and more popular nowadays so it is possible that we will have more similar monadic structures. Then, this knowledge will be even more very valuable.

Let’s start with describing what a monad is – more or less accurately. In my opinion, the matter here is fairly straightforward.

How Technology Is Making the Experience of Gaming Better


The evolution of gaming and technology has been a colossus affair with each taking a step forward in the direction shown by the other. The seeds of growth, innovation were sown and foreseen a long ago.

It has traveled a distance far away from tying us down to giant devices to shrunken into the palm of our hands. Does it sound eccentric when you ask a 50-year and 20-something about their favorite pastime, and they include gaming as one of the options?