51 Working with the IO type

After reading this lesson, you will be able to

  • Manipulate values produced by side effects using the map and flatMap operations
  • Compute multiple IO instances in sequence using for-comprehension
  • Execute side effects in parallel to maximize the resource of your program

In the previous lesson, you learned the basics of the type IO. You’ll now see how to compose smaller side effects to create programs you can lazily describe and run. You’ll master how to use the map and flatMap operations to manipulate values that impure functions produce. You’ll discover how to combine them in sequence using for-comprehension. Also, you’ll see how to run them in parallel using the parSequence method. In the capstone, you’ll combine ...

Get Get Programming with Scala 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.