Parser Errors: from Nil to Throws

Episode #176 • Jan 31, 2022 • Subscriber-Only

Let’s explore the topic of error handling. We will scrutinize how we model errors in our parsing library and the problems that have come out of it, and we will address these problems by changing the fundamental shape of the parser type.

from Nil to Throws
Introduction
00:05
The need for errors
00:39
A better way
07:39
Simplifying existing parsers
12:07
Parser error messages
19:25
Next time: contextual errors
32:24

Unlock This Episode

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

Introduction

Last week we finished up a series of episodes bringing result builders to our parsing library, and even released a whole new version of the library that converts everything to the new builder style. We showed that the builder syntax removes a lot of noise from building large, complex parsers and even unlocks new styles of API design that were not previously possible.

This week we are going to address another change to the library that will bring many ergonomic and quality-of-life improvements to using it. We are going to demonstrate how to add basic error handling to the fundamental shape of parsers, which will give us an opportunity to better describe what goes wrong when a parser fails.

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

What is @_disfavoredOverload in Swift?

Federico Zanetello • Tuesday Nov 10, 2020

A journey into Swift overloading thanks to this private attribute.

Downloads