Now we see map
, zip
and flatMap
are an important trio of operations and each does one thing and does it well. We should now be able to convince ourselves that we shouldn’t be smudging their definitions just to suit our needs. We will likely come across functions with signatures that look a lot like flatMap
and may even be tempted to call it flatMap
, but doing so can destroy all of our intuitions around what flatMap
is. Right now we have 6 types that we are very familiar with and all of the operations behave roughly the same, even for very different types.
And this lesson is an important one, but just 10 or 11 months ago we had a decisive moment in Swift history where the community got to learn from this and put it to real-world use. We actually had an entire episode dedicated to this back then, but now we are even in a better position to appreciate it, so let’s briefly recall the problem.