Higher-Kinded Data Types by Example

Chris Penner

Playlists: 'bobkonf2021' videos starting here / audio

This example-driven talk introduces and explores “Higher Kinded Datatypes” (HKDs), a novel approach to parameterizing data types which allows greater flexibility, re-use, and improved type-safety when performing common tasks on data.

While many data types are parameterized over the values in the type; HKDs are generalized over a container type which wraps each field.

This approach also allows us to “zip” record fields in a type-safe way, allowing us to append structured error messages to parsers among many other things. It is a surprisingly versatile technique, which hasn’t yet received the attention it deserves.

The talk may also cover practical developments in this area such as the barbies HKD combinator library and the derivable “Generics” representation of this idea a’la higgledy, both of which make writing practical everyday code using HKDs much easier.

Download

Embed

Share:

Tags