Roll Your Own Shapeless
summary
Recreates core Shapeless pieces in plain Scala: builds an HList with append, implements remove, map and nth as type-level proofs resolved by implicits, uses dependent output types to carry computed types out of implicit search, and encodes polymorphic functions with an inner-case poly trait. nth needs a whitebox macro for int→Nat plus an implicit conversion workaround; implicit prioritization and companion-scope tricks resolve ambiguities. All features compile and work, but rely on compiler quirks (SI-2712, implicit search behavior) and accept practical limitations.
AI-written summary · about
chapters (13)
- 0:00Intro
- 0:32Shapeless
- 9:42Context-Dependence
- 10:45Roadmap
- 11:06HList#remove
- 12:05Implementation
- 17:28Remover
- 23:42Implicits!
- 29:43Downsides
- 30:56Exercise 3.1
- 36:20Peano Arithmetic
- 36:52Macros
- 45:02Conclusion
related talks
55mThe Shape of Shapeless (Part 2)
56mThe Shape of Shapeless (Part 1)
36mShapeless all the things !!
46mAutomatic type class instance derivation with shapeless
24mLet the Scala compiler work for you
44mType level Computations in Scala
48mA gentle introduction to type level programming in Scala
22mTransformation Function Called Higher-Order
