A Look at Monad Transformers and Free Monad

In Chapter 6Exploring Built-In Effects, we looked at standard effects and promised to reveal the truth about the concepts underlying them; we also discussed the topic of combining them. Since then, we have discussed algebraic structures, such as monoids and groups, functors, applicatives, and monads, delivering on our first promise. But the composition topic has remained uncovered all this time.

In Chapter 8, Dealing with Effects, we implemented a general way to compose applicatives—which is very useful on its own, but can't help us with combining the standard effects of a monadic nature.

In this chapter, we will finally take on and keep our second promise by discussing some ways to bring different monadic effects together. We will look at the complications related to that and some of the solutions used in the Scala community to deal with these obstacles, including:

  • Monad transformers
  • Monad transformer stacks
  • Free monads
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.226.34.197