Using monads

Simply having a monad trait puts us in a framework that we can follow. We already went through the theory of monads and the laws that they follow. However, in order to understand how monads work and what they are useful for, looking at an actual example is invaluable.

However, how are we supposed to even use monads if we don't know what their purpose is? Let's call them computation builders, as this is exactly what they are used for. This gives the ordinary developer much more understanding about when and where to use monad's computation builder chain operations in some way, which are then performed.

Get Scala Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.