Existential Types — Make OOP Great Again!
summary
Existential types are encoded as abstract type members so a Unix-style API can hide raw ints for file descriptors and force creation via open, eliminating forged 42 errors; UI examples use path-dependent types to model container/tabs state without unsafe wildcards (requires a trait work‑around because the compiler rejects the straightforward case class pack); plotting examples show type families that remove casts between Plot and Dataset; finally tagless DSLs give extensible interpreters.
AI-written summary · about
chapters (34)
- 0:00Intro
- 0:15Outline
- 1:24Complexity
- 1:45Modularization and generalization
- 3:271.2 Square of abstraction
- 3:47Value parameters
- 4:42Scala square of abstraction (2)
- 5:48Scala square of abstraction (3)
- 7:53Scala square of abstraction (4)
- 9:10Scala square of abstraction (5)
- 10:24Use cases
- 10:35Scala interface for nix files API
- 11:51Hiding the File type
- 13:21Why is it different from using an opaque type?
- 14:23Encapsulation - summary
- 14:52User interface Component
- 15:19Counter component
- 15:43Container component
- 19:45Redesign Component with abstract type members
- 22:17Tabs - view implementation
- 22:32Modularization - summary
- 24:36Naive solution - XYPlot
- 25:54Solution with abstract type members
- 26:38Type families - summary
- 27:34Questions?
- 29:10Evaluating programs
- 29:40Generalizing interpreters
- 30:02Alternative encoding: language definition
- 30:47Alternative encoding: evaluation interpreter
- 31:15Alternative encoding: interpreting programs
- 31:48Finally tagless encoding - extensibility
- 33:23Type parameters vs type members (1)
- 34:33Finally tagless encoding - summary
- 36:05Tabs component implementation
related talks
35mLiteral types what they are good for
24mExistentialize your Generics
49mAcademese to English: Scala's Type System, Dependent Types and What It Means To You
23mReasoning about types and code
37mTypes that Change: The Extensible Type Design Pattern
42mDOT: Scala Types from Theory to Practice
19mDeriving Dependently-Typed OOP from First Principles
28mTo impl or not to impl: The State of Existential Types in Rust
