Abstract
In this tutorial, I will introduce "generics-sop", a library that supports datatype-generic programming in Haskell.
The idea of datatype-generic programming is to expose a uniform, yet typed, representation of all datatypes, which can be used to define algorithms that work over a large class of datatypes, and can automatically adapt to changes in datatypes.
Examples of datatype-generic functions are functions that are typically "derived", such as equality and comparison functions, all sorts of (de)serialization functions to various formats, traversals and accessors, editing operators, functions for querying and updating databases, and many more. The specific structure that generics-sop uses is based on heterogenous lists and heterogeneous choices. Working with them in Haskell requires several type system extensions available in Haskell, such as GADTs, data kinds, polymorphic kinds, constraint kinds, and rank-n polymorphism.
We will define several example generic functions using generics-sop, and use the goal of datatype-generic programming as a motivation to introduce the type system features that we need.
Tutorial objectives
Target audience
Intermediate and advanced Haskellers with solid knowledge of the core language features, and who want to learn more about type-level and/or datatype-generic programming. No prior knowledge of type system extensions such as GADTs or data kinds is assumed.
Infrastructure Required
Participants need to bring a laptop with the GHC compiler (>= 8.0.1) and