O'Reilly logo

Scala Design Patterns by Ivan Nikolov

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

Monads

In the preceding section, we defined functors. With their map methods, the standard Scala collections seem to be good examples of functors. We should, however, emphasize again that a functor doesn't mean a collection—it can be a container and any custom-defined class. Based on an abstract map method and the rules it follows, we can define other functions that will help us reduce code duplication. However, there are not many exciting things we can do based on a mapping only. In our programs, we will have different operations, some of which not only transform a collection or an object, but also modify it in some way.

Monads are another one of those scary terms that come from category theory, which we will try to explain in a way that you will ...

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