Staged Sums of Products
summary
Generics-sop programs are often ~6x slower than handwritten code because of runtime conversions; this work builds staged-sop using Typed Template Haskell to generate specialized code at compile time. Conversion functions become continuation-style that produce code-wrapped components (C), combinators like czipWith and mapC build quoted applications, and top-level splices cancel to yield code equivalent to the handwritten version, matching its performance. A quoted-constraint form (e.g. quoted Semigroup a) is added and implemented in a GHC branch to handle overloading across stages.
AI-written summary · about
chapters (12)
- 0:00Intro
- 0:16Example: semigroup append
- 2:02generics-sop
- 2:43Generic semigroup append
- 6:45What about efficiency?
- 7:59Typed Template Haskell
- 9:06Staging constructs
- 10:56Staged serigroup append
- 16:19staged-sop
- 17:15Quotes and constraints
- 19:33In the paper
- 20:35Conclusions
related talks
25mStaging with Class: A Specification for Typed Template Haskell
15mMetaprogramming with Combinators
14mMulti-stage Programming in the Large with Staged Classes
15mStaged Selective Parser Combinators
29mStaging Automatic Differentiation with Fusion
23mContextual source code AD transformations for sum types
33mProgram Synthesis Using Example Propagation
48mOpening Keynote
