🎉 Cyber Monday Sale! Save 30% when you subscribe today.
We’ll define the functional trio of operations on the Parser
type: map
, zip
and flatMap
. They introduce a familiar means of transforming and combining simple parsers into more and more complex parsers that can extract out first class data from nebulous blobs of data.
The Parser
type isn’t the only type that supports map
, zip
and flatMap
operations. There are many types that can be transformed in similar ways, and even the Swift standard library and Apple frameworks ship with many examples. This collection of episodes explores this topic deeply, and hopes to empower you to define these operations on your own types as well.
Now that we’ve seen that parsers have map
, zip
, and flatMap
operations, it’s time to take things to the next level and explore a whole bunch of what are commonly called “parser combinators”: or “higher-order” functions that enhance and combine parsers in more and more interesting, complex ways.