Derive class instances topdown and derive ttg automatically
summary
Introduces a top‑down deriving engine that generates multiple related class instances (handles nested/composite types and classes with many superclasses) and a Template Haskell generator that emits decoratable type families (TTG) automatically; provides four Template Haskell APIs and uses SYB substitution with Any to make GHC’s instance check work on polymorphic types. Works on ST and GHC source types and eases boilerplate for packages with many types (example: 78 data types), but mutual recursion and some Haskell-src-ext support remain buggy.
AI-written summary · about
chapters (9)
- 0:00Introduction
- 3:15Composite data types challenges
- 6:49Four APIs for instance generation
- 8:36Polymorphic type issues
- 12:56Context inference with data
- 17:43Controlling type generation
- 20:56Future work on top-down deriving
- 21:16Automatic TDG generation
- 22:24Q&A
related talks
25mDeriving Instances with Dependent Types
49mMaking sense of the Haskell type system
50mTemplate Haskell, a case study in (in)stability
25mStaging with Class: A Specification for Typed Template Haskell
46mAdding kind-polymorphism to the Scala programming language
32mHole Refinements for Polymorphic Type-and-Example Driven Synthesis
01h 02mType Inference in GHC
56mOn Type-Based Techniques for Program Manipulation
