concept extractYearStart in category functional programming

This is an excerpt from Manning's book Grokking Functional Programming.
Let’s look at our current example from the perspective of composability. In our case, we have three small functions: extractName, extractYearStart and extractYearEnd. They all return Options so we know that in order to use them, we’ll need to handle both Some and None case. We want to build a bigger function that is responsible for parsing a raw TV show, handling all the corner cases that are represented by Options encoded in extract functions. The for comprehension we used is one example of that: it composes three different values of Option in order to produce one output value: an Option[TvShow]:
![]()
Breaking requirements into smaller blocks of code is a very natural approach in functional programming, because it’s much easier to achieve than in other paradigms. I know what you are thinking. “Why is this better than checked exceptions?!” Point taken. We will compare this approach to throwing checked exceptions in Java very soon. But before we do it, let’s finish the Option-based parseShow by implementing the three small remaining extract functions, which contain details about extracting data from a raw string. I will show you how to implement the extractYearStart and ask you to do the two remaining as an exercise.