Parser Combinators Recap: Part 2

Episode #120 • Oct 12, 2020 • Subscriber-Only

We round out our parsing recap by reintroducing that functional trio of operators: map, zip, and flat-map. We’ll use them to build up some complex parsers and make a few more ergonomic improvements to our library along the way.

Part 2
Introduction
00:05
Map, Flat-Map, and Zip
01:13
Parsing many values
13:20
Parsing a value many times
21:32
Even more ergonomic parsing
32:43
Next time: XCTest log parsing
37:07

Unlock This Episode

Our Free plan includes 1 subscriber-only episode of your choice, plus weekly updates from our newsletter.

Introduction

Now all of these parsers are cool and all, but the real power comes in the composability of parsers. The Parser type supports many forms of composition that unlock the ability to break large, complex problems into simpler ones. And ideally we can be very confident that the small parsers do their job correctly, like the int and double parsers, and then we can be confident that we glued all the parsers together correctly.

This episode is for subscribers only.

Subscribe to Point-Free

Access this episode, plus all past and future episodes when you become a subscriber.

See plans and pricing

Already a subscriber? Log in

References

Collection: Parsing

Brandon Williams & Stephen Celis

New to parsing? Start our collection from the beginning!

Parsing is a surprisingly ubiquitous problem in programming. Every time we construct an integer or a URL from a string, we are technically doing parsing. After demonstrating the many types of parsing that Apple gives us access to, we will take a step back and define the essence of parsing in a single type. That type supports many wonderful types of compositions, and allows us to break large, complex parsing problems into small, understandable units.

Downloads