Parsing with Haskell

Parsing Series Graphic.png

Haskell is an excellent language for all your parsing needs. The functional nature of the language makes it easy to compose different building blocks together without worrying about nasty side effects and unforeseen consequences. Since the language is so well-suited for parsing, there are several different libraries out there. Each of them differ a bit in their approaches. We'll explore three libraries in this series.

Part 1: Gherkin Syntax

Before we start learning the specifics of any parsing library, we need to know what it is we're parsing! In part 1 of this series, we'll learn about Gherkin Syntax, which will serve as our example language throughout this series. We'll also look into some things about Haskell that make it such a good parsing language.

Part 2: Applicative Regex Parsing

In part 2 of this series, we'll take our first steps into the world of parsing code. We'll dive deep into the Regex Applicative Parsing library. This library allows us to parse any regular language without even using a monad! Of course, we'll have to first get acquainted with some of the lesser known applicative operators. But as we build up our parsers, we'll see some really neat ideas about how they fit together.

Part 3: Attoparsec

In part 3 we'll explore the Attoparsec library. This will be our first look at a monadic approach to parsing. Introducing a monad into our program always brings a certain amount of cognitive overhead. But we'll see that in return our code will describe our program much more cleanly.

Part 4: Megaparsec

In the fourth and final part of our series, we'll learn all about Megaparsec. This library has a lot in common with Attoparsec, but brings in a few extra features for some cool added functionality!

Review: Production Checklist

This series shows some awesome examples and neat libraries. But there's still a ton more to learn beyond the world of parsing! There are many different libraries out there that will help you with many different production tasks, from setting up a database to building a web API. To find out more, download our FREE production checklist.