Type level Computations in Scala
summary
Shows precise techniques: implements type-level booleans, natural numbers and HList style heterogeneous lists, defines +, × and exponentiation by structural recursion, and builds a hybrid value/type fold so runtime uses plain ints while the compiler checks sizes. Claims zero runtime overhead and says parts ship in Slick to represent tuples beyond 22 columns. Notes painful boilerplate for type lambdas, occasional unsafe casts, no recursive types or type unification, and slower compile time for heavy computations.
AI-written summary · about
chapters (11)
- 0:00Type level computations in Scala
- 1:50Motivation for type level
- 4:37Term level booleans to types
- 11:47Natural numbers at type level
- 16:45Type level addition and recursion
- 20:21Folds and church numerals
- 26:42Challenges of type level
- 29:55Combining type and term level
- 33:06Heterogeneous lists and hybrids
- 37:45Limitations and trade-offs
- 40:59Shapeless and Q&A
related talks
48mA gentle introduction to type level programming in Scala
44mTelling the Truth with Types
30mConstraint Typing with Boolean Algebra
42mLet the Compiler Help You: How to Make the Most of Scala's Type System
49mThe Trouble With Types
28mSecrets of the Scala Type System
22mTransformation Function Called Higher-Order
23mType-Level Programming with Match Types
