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