Summary
In this chapter, we got familiar with optional types. We talked about built-in techniques to deal with Optionals
such as optional binding, guard, coalescing, and optional chaining. Then we explored functional programming techniques to deal with Optionals
. We created fmap
and apply
functions and related operators to tackle multiple optional binding problems. Even though some developers may prefer to use built-in multiple optional binding, exploring functional programming techniques practically provides a better understanding of concepts that we will be able to apply to other problems.
Finally, we briefly looked into error handling concepts and how to convert errors
to optional values.
In the next chapter, we will explore some examples of functional data structures such as Semigroup
, Monoid
, Binary Search Tree
, Linked List
, Stack
, and Lazy List
.