ADVENTURES IN META-PROGRAMMING
summary
Compares three meta-programming options in Scala and demonstrates two concrete case studies: auto-constructing case-class instances and building field-aware validators. Implements a macro that inspects companion apply, initially hardcodes three types then extends via a Pure type-class with implicits to support arbitrary types; builds a shapeless version using Generic/HList and LabelledGeneric to derive constructors and field names, which is more robust but heavier and slower to compile. Ships a working checklist validation library; macros win for concise syntactic tasks, shapeless for type-level derivation.
AI-written summary · about
chapters (8)
- 0:00Start
- 0:06Adventures in Meta-Programming Macros vs Shapeless
- 3:16constructing values
- 9:05macros v2
- 16:29data validation
- 25:26summary
- 26:12meta-programming is a convenience
- 28:20bonus macro unindent








