Generalization

Section • 3 episodes • 2 hr 3 min

So far, the parser library we have been building is needlessly restricted to parsing only strings. There are lots of things that we’d like to parse, such as URL requests for application routing. By generalizing the Parser type we will gain the ability to parse many types of inputs, and we will uncover many unexpected benefits, including the ability to make our parsers much more performant than they currently are.

Related content

Parsing is just one of many problems functional programming solves by defining a core, composable, transformable unit. We apply these exact same techniques to randomness and even app architecture!

Randomness
3 hr 36 min
Composable Architecture
17 hr 50 min

Where to go from here

We have built a powerful parser library with a focus on composability and generality, but there’s one important facet of parsing missing: performance. We will discover how to unlock a new level of performance from our parsers, making them competitive with more ad-hoc styles of parsing.