Generalized algebraic datatypes (GADTs) are often considered an exotic academic curiosity with no bearing in practical applications. In this talk, we’ll explore how to apply GADTs to a real-world problem: implementing a simple GraphQL server. In that process we’ll demonstrate how GADTs allow us to model the problem domain accurately in the type system. As a result, we can get many compile-time guarantees that is typically solved with runtime checks and type coercions in other libraries. Examples will be in OCaml.
Andreas Garnæs leads a team of engineers at Zendesk, where GraphQL is playing an increasingly important role. After much frustration about the lack of type safety in other GraphQL implementations, Andreas authored a GraphQL library in OCaml. Besides OCaml, Andreas is excited about microservices, Go and Ruby.