Exploring Built-In Effects

Sometimes, computers do things differently compared to what the developer expects. Sometimes, a function can't return a value for a given set of arguments, a device is not available at runtime, or calling an external system takes much longer than expected. 

Functional approaches strive to capture these aspects and express them with types. This allows for precise reasoning about the program and helps to avoid surprises at runtime.

In this chapter, we will study how the mentioned aspects are covered by Scala's standard library. We'll take a look at the following:

  • Foundations of encoding runtime aspects with types
  • Option
  • Either
  • Try
  • Future

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