Brandon is a life-long learner, programmer, and teacher. The thing he loves most about Haskell is that every new thing he learns uncovers an underlying truth about the nature of programming. Some of his interests include running the Haskell bootcamp at his company, jamming on the guitar, and, thanks to the pandemic, playing way too much Overcooked 2.
The aeson library provides a lot of great support for serializing and deserializing JSON data to and from Haskell data types. But for some use cases, Haskell data types are too cumbersome to work with. For example, deeply nested JSON data would require roughly one Haskell data type per level, with a long chain of getter functions or lenses to extract data back out. In this talk, I’ll be providing an overview as well as a deep-dive of one of LeapYear’s open source projects, aeson-schemas. This library provides quasiquoters that define JSON schemas at the type-level and extract JSON data at the data-level, with all errors checked at compile-time.