Northeast Scala Symposium
2023

Miles Sabin

Miles has been doing stuff with Scala for more than a decade, currently with Underscore Consulting. He is a cofounder of Typelevel and his best known project, the Scala generic programming library shapeless, is the weapon of choice wherever boilerplate needs to be scrapped or arities abstracted over.

Grackle: Functional GraphQL for the Typelevel stack

Abstract - GraphQL is a query language for typed APIs. This is a talk about a new GraphQL engine, built for the Typelevel stack, and the techniques drawn from compiler design and implementation that have been used to build it.

This is a talk about Grackle, a purely functional GraphQL engine built for the Typelevel stack, a perfect fit for applications built with Cats, Cats Effect, FS2, Doobie and Skunk. Although relatively young, it has been battle tested at ITV in their new streaming platform, ITVX, where it provides content metadata for all clients (connected TVs, mobile devices, web, etc.) and also plays important roles in news and content distribution. I'll talk a little about features and coverage of the GraphQL Specification, but I mainly want to focus on design and implementation techniques. GraphQL is a query language for typed APIs. Talk of languages and types might make you think of compilers … and you'd be right to! I will show how techniques drawn from compiler design and implementation can be applied in what might seem like a very different domain. I will show how we can compile GraphQL queries into programs in a simple internal query language, type check those programs, transform them in a variety of ways (for instance to map a GraphQL query onto an efficient SQL query, or to compose several independent APIs into a single uniform API) and then interpret the resulting program to execute the query. Finally I hope to inspire people to investigate and contribute to the project.