Programmer builds a language whose compiler outputs one giant SQL query
Arrows to arrows, categories to queries (2025)
Sandy Maguire wrote catlang, a small programming language that compiles to a single monstrous SELECT statement in postgres. Its intermediate representation is built from abstract category theory constructs, each with simple algebraic semantics, so retargeting the compiler to new backends becomes straightforward. A sample function that returns 100 via a loop desugars into a dense unicode expression and then into SQL so deeply nested it's nearly unreadable.
Why have I done this? Because I needed a funny compilation target to test out the actual features of the language, which is that its intermediary language is a bunch of abstract category theory nonsense.