O'Reilly logo

Introduction to JVM Languages by Vincent van der Leun

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exploring monads by applying test-driven development

Monads are used in functional programming to build simple components. They are used to chain a series of operations in a safe way. Each component encapsulates a value and makes sure that the next component that is called could handle its output as input. For example, if component A generates nil (null) as output and the next component in the chain cannot handle nil as input, the computation of the chain will be stopped automatically.

In Haskell, a pure functional programming language, monads are used prominently. Still, they can be useful in other functional programming languages as well. We will take a brief and very high-level look at monads here and skip a lot of complex theory and background ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required