Lord of the rings: the Spire numerical towers
summary
Spire implements about 80 typeclasses, roughly 30 from algebra and cats‑kernel, and argues which parts follow mathematics and which are pragmatic design. It documents a concrete win: clarified laws of the % operator and provides two usable remainder semantics (truncated vs floored mod) so negative offsets wrap predictably. It formalizes a commutative‑ring tower to support integer factorization and Euclidean division, exposes triplicated group APIs (additive/multiplicative/vanilla), and admits coherence, instance selection and algorithm‑choice tradeoffs.
AI-written summary · about
chapters (11)
- 0:00Start
- 0:47Type classes for numeris
- 5:48Plan (typeclasses design trade offs)
- 6:51Reverse Hascalator
- 9:41What is %?
- 13:48Canonical instances
- 16:30Conventional natation/syntax
- 20:26Lawless type classes are OK
- 21:52Plan (type classes design trade offs)
- 22:12(Not) closing the lattice
- 24:38Algorithm selection
related talks
20mFixing the rusty core of the internet with functional prog.
55mMonoids, Monoids, Monoids
42mProgramming with Math
58mKeynote: Why Functional Programming Matters
43mMonoidal Adventures
41mLambda Core - Hardcore
57mApplied category theory and abstract algebra
51mGoing bananas with recursion schemes for fixed point data types
