Roll Your Own Shapeless
summary
Recreates core Shapeless primitives from scratch using Scala implicits and a handful of macros, showing concrete implementations of HList append, type-indexed remove, map via polymorphic functions in implicit scope, and an implicit macro that lifts integer literals to Peano naturals so nth indexing compiles to precise types. Demonstrates the surprising constraints and workarounds—dependent output types, aux pattern, low‑priority implicits—and shows the resulting machinery composes and works within Scala 2’s compiler quirks.
AI-written summary · about
chapters (19)
- 0:00Intro
- 0:19Miles Sabin
- 1:54Previously on Daniel...
- 4:48Context-Independence
- 8:37Type Level Functions
- 9:57Context-Dependence
- 11:32Roadmap
- 11:55HList#remove
- 12:59Implementation
- 16:04"Out" Types
- 17:59WARNING
- 19:35Remover
- 23:24HList#map
- 25:16Implicits!
- 30:45Downsides
- 31:52Exercise 3.1
- 36:55Peano Arithmetic
- 38:17Macros
- 45:45Conclusion
related talks
31mShapeless? - Easy!
43mAdventures in Metaprogramming: Macros versus Shapeless
29mADVENTURES IN META-PROGRAMMING
01h 01mThe Shape(less) of Type Class Derivation in Scala 3
24mLet the Scala compiler work for you
23mPlaying with Shapeless
45mHow to be polymorphic in Scala
45mTypelevel Programming 101: The Subspace of Scala
