String diagrams: a visual language for type systems, showing monads are monoids in endofunctor categories
roboguy20 · x · 2026-10-18
roboguy20's new blog post introduces string diagrams, a graphical language for reasoning about many type systems.
- The diagrams make copy (contraction), discard (weakening) and swap (exchange) explicit, making them a natural fit for linearly typed languages.
- Each diagram maps to an expression: inputs on the left correspond to free variables, outputs on the right to results, illustrated with typed examples like x:Nat, y:Nat ⊢ x+y:Nat.
- The payoff: a visual proof that the monad laws mirror the monoid laws — the post's figure puts list associativity (x++y)++z = x++(y++z) side by side with join . join = join . fmap join, making "a monad is a monoid in the category of endofunctors" concrete.