CASE STUDY FOR A REAL-WORLD TYPE-LEVEL PROGRAMMING
summary
A compile-time JSON codec generator uses shapeless (Generic, HLists, coproducts) to derive Play JSON type class instances so case classes with more than 22 fields and sealed trait hierarchies serialize without hand-written code. It replaces fragile macros from play-json (one 700-line macro) with about 50 lines of custom shapeless code, handles optional fields by omitting None, falls back to play-json defaults for primitives, and successfully produces usable serializers and deserializers.
AI-written summary · about
chapters (6)
- 0:00Introduction and motivation
- 2:44The problem with JSON
- 8:12Analyzing macro complexity
- 10:24Shapeless fundamentals
- 14:00Implementing custom codecs
- 19:44Co-products and conclusion








