Will be streamed live today, 2025-12-10, at 1930 UTC.
Abstract:
Parsers and printers go hand in hand. When we want to parse unstructured data into a more structured syntax tree, we often also want to render syntax trees back to text, and we typically want the parser and printer to be compatible. However, most libraries end up treating parsers and printers separately, leading us define these two functions independently from each other. In this episode we will look at the autodocodec library, built on top of aeson, as an example of how you can combine JSON parsers and printers and derive them from a single description. The fundamental idea is not at all limited to JSON though and widely applicable.
I couldn’t help but chuckle at the obviously not AI thumbnail
Wonderful episode, like always. I really understand the appeal of having an internal mini DSL with which you can generate more stuff automatically. Makes me think of servant.
Finally got around to watching this, I liked this exploration of an alternative to Generic derivation of From- and ToJSON.
One reason to disconnect type from instance as you discussed was when you want the instance to evolve independently from the data type or vice versa; in an API you would want to support and output the new content while not breaking existing inputs. I had a brief look at autodocodec, and saw that there is a EitherCodec in the Codec type, but there wasn’t an easy to use Alternative instance, which makes the ergonomics a bit tougher.
While making this video, had you seen this post by @Lysxia on bidirectional parsers? It’s an excellent exploration of doing all this work in a limited set of structures.