12 Functional input/output
In this chapter
- Applying effects safely from inside contexts
- Combining effects for success and failure
- Safely reading data
- Using the
IO
type and imperative-like control structures - Combining
IO
operations
So far you’ve learned how to write safe programs that haven’t produced any usable results. You’ve learned how to compose true functions to build more powerful functions. More interestingly, you’ve learned how to use nonfunctional operations in a safe, functional way. Nonfunctional operations are operations producing side effects such as throwing exceptions, changing the outside world, or depending on the outside world to produce a result. For example, you learned how to take an integer division, which is a potentially ...
Get The Joy of Kotlin 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.