Is a monad more like a burrito or a railroad?

Spoiler: this blog post won’t explain what a monad is :)

A recent reddit post asked the question that inspired the title of this post:

Is a monad more like a burrito or a railroad?

I was immediately fascinated by this question because it embodies a core problem that surfaces for many who want to learn Functional Programming: depending on your background you may find some abstract concepts completely intuitive or absolutely obscure. For some, abstraction makes code more readable. For others, it clouds the concrete intention of the code one is reading.

In my opinion, it helps to find metaphors and examples that illustrate these concepts. The further away the metaphor is from software and computers, the better.

Take this gem of an example:

Source unknown

With a bit of context about what Variance is in Scala, this diagram has the power to unblock your understanding of a concept that is typically hard to grasp.

This is a technique that I personally try to use as often as I can in training, and I believe it helps tremendously.

These tricks are at the core of our design of ScalaQuest. We believe that immersing you (the player) in a fantasy virtual environment allows us to create metaphors that can unblock you and stay imprinted in your subconscious, effectively making it easier to reason about structures and features that are otherwise difficult to understand.

If you think we’re on to something, take a look at our Kickstarter project and support us, so we can use these tricks to teach many other people how to use Scala effectively.