Let the Compiler Help You: How to Make the Most of Scala's Type System
summary
Shows practical Scala techniques to make the type system catch real bugs: use smart constructors and private companion constructors to prevent invalid values, wrap failures in Option instead of throwing, and encode invariants with small predicate types like nonEmpty, positive, or validEmail. Demonstrates using macros for validation to move checks to compile time where possible, and gives examples of which runtime checks disappear, what the compiler can and cannot prove, and when macros or runtime validation are still needed.
AI-written summary · about
chapters (6)
- 0:00Scala's type system
- 10:02Compiler needs help
- 17:05Email inputs with Option
- 23:06Smart constructors
- 33:14State transitions with types
- 39:02Q&A
related talks
48mA gentle introduction to type level programming in Scala
30mConstraint Typing with Boolean Algebra
28mSecrets of the Scala Type System
49mThe Trouble With Types
44mType level Computations in Scala
44mTelling the Truth with Types
50mSimple code for a type safe world
44mType Parameter Power Up Variance Bounds and Inference
