June 18, 2013 · 7:00 PM
We're joining the lovely Berlin Haskell User Group (HUGs) to hear Andres Löh from Well-Typed talk about Datatype-Generic Programming in Haskell.
Here's the abstract:
Haskell's deriving construct is magical and wonderful at the same time:
wonderful, because with just a single line, you can get functionality for your
newly defined datatype such as (de)serialization, comparison and traversal
functions for free; magical because all of this happens behind the scenes, by
compiler magic. Or does it? Since recently, the Glasgow Haskell Compiler (GHC)
supports a feature that lets you define your own derivable functionality! And
it is not difficult to do, either. All you have to do is understand a little
bit about how Haskell datatypes can be uniformly represented using a limited
set of simple datatypes. Then you can define instances of your code for this
limited set, and get the rest for free. This so-called datype-genericity is so
important, because it further encourages programmers to define domain-specific
and precise types; there's less of a price to pay if lots of functionality is
nearly automatically available for free, even for such new datatypes.
In the talk, I will explain all about how datatype-generic programming in GHC
works, and I will present a number of examples of how it can be used or is
already used in prominent Haskell libraries.