Spotlight on Victor Cacciari Miraldo
When: Thursday, October 17th - 12:00
The ins and outs of Generic Programming
Generic Programming is the technique of writing programs that works over a class of arbitrary data types. That is how automatic toJSON and fromJSON are implemented in Haskell, for instance. They work by induction on the datatype they are translating to or from JSON. The variety of ways of writing generic programs can be daunting, each coming with their own pros and cons. In this workshop I will outline the ins and outs of some libraries. We will look into the trade offs and examples of each approach, including some state-of-the-art techniques. We start the journey with GHC.Generics, go into Generics.SOP and finish at Generics.MRSOP. We will cover simple examples such as generic serialization well into more complicated ones such as generic unification. These will require us to fiddle with the representation of our types and perform some operations such as annotating a recursive datatype and adding holes to a datatype in a generic fashion, which are useful in practice.
During this workshop I will walk the participants through a number of hands-on generic programming exercises aimed at teaching them a number of useful techniques which show up in practice. I expect the attendees to have some intermediate-level Haskell experience and a working Haskell distribution on their computers.
We will look into three main flavors of generic programming over regular data types and we will talk about more advanced concepts such as GADTs and Mutually Recursive families if time allows.
I will walk the participants through a number of generic algorithms, where they will be implementing a significant part of the algorithms below. The boilerplate code and stack.yaml file will be provided by me. Ideally, I would like to cover:
- Generic Equality
- Generic Serialization
- Generic Merkle Trees (which involve annotated fixpoints)
- Generic Unification (which involve adding holes to the types in question)
- Testing strategies for stateful systems
I am a PhD candidate at Utrecht University, for four days a week, where we work on generic structural diffing algorithms, and I also work for Oracle Labs, on my fifth weekday, where I develop Blockchain technologies using Haskell. I am very interested in Functional Programming in general. I spend most of my time developing Haskell or Agda. My PhD project relies on state-of-the-art generic programming techniques and most of the time we must develop our own libraries from scratch to cater for it.
For more on Victor, visit:
About Lambda World:
Lambda World takes place October 17th - 18th, in Cádiz, Spain and is hosted by 47 Degrees in conjunction with the Scala and Java communities of Spain. The event is located at the Palacio de Congresos, an old tobacco factory near the beach. You can find more details at Lambda.world