Arrows to Arrows, Categories to Queries
17 days ago
- #SQL-compilation
- #category-theory
- #programming-languages
- The author created a programming language called 'catlang' that compiles to SQL.
- Catlang's intermediary language is based on abstract category theory concepts.
- The language features include arrows, loops, and algebraic semantics for operations.
- A function in catlang demonstrates a loop that always returns 100, showcasing the language's capabilities.
- The intermediary language uses categorical operations like composition, projections, and coproducts.
- Compilation to SQL involves representing product types as columns and coproducts with nullable columns.
- Cochoice in catlang corresponds to recursive CTEs in SQL, enabling loop constructs.
- The author discusses potential future directions, including meta-circular interpreters and brainfuck compilation.
- The project is inspired by Haskell's arrow syntax and Compiling to Categories paper.
- All code is available on GitHub, with a template-Haskell backend for generating Haskell code.