Depending on Types
summary
Argues that Haskell already supports a lot of dependently typed programming by using GADTs, datatype promotion and type families to encode invariants; demonstrates with a red‑black tree implementation that adds precise types for red-black trees, `hidden`/`almost` tree forms, `balance`/`insert`, and singleton types to keep runtime values. Notes some patterns cannot be promoted yet, presents a GHC branch (Eisenberg) that lifts promotion limits, uses a singleton library as a workaround, and contrasts weaker totality guarantees versus Agda/Idris/Coq.
AI-written summary · about
chapters (17)
- 0:00Introduction
- 1:16Overview
- 1:47Running Example
- 3:48Red Black Trees
- 6:34Rebalancing
- 8:43Type checker
- 11:58Dependent types
- 13:49RBT type
- 15:56GHC type
- 17:37Differences between types
- 18:59Type promotion
- 19:30Erased types
- 26:15Hidden trees
- 30:30Type family
- 36:07Not proving is simpler
- 38:31Whats next
- 41:06Why not Haskell
related talks
39mDependent Types in Haskell
01h 57mTypes as Program Specifications: A Intro to Type-Level Programming in Haskell
49mThe Trouble With Types
48mEnhancing your Haskell with Dependently Typed Programming
33mStatically Typed Interpreters
35mGADTs and You; Writing Safer Code Using GADTs
38mType Systems - The Good, Bad and Ugly
56mWrite You Some Proofs for Great Good
