Skip to main content

Scala

The Elm Architecture: a loop that fits in your head

·14 mins
Model, Update, View. Three pieces, one loop, zero surprises. We explain The Elm Architecture from scratch with side-by-side examples in Rust and Scala, trace where the pattern came from, why it keeps showing up in TUIs and functional codebases, and when it stops being the right tool.

Tagless Final is denotational semantics in disguise

·10 mins
Every trait in your hexagonal architecture is a tagless-final algebra. Every impl is an interpreter. You have been writing denotational semantics without knowing it. We trace the connection from Kiselyov’s paper through Scala’s Cats-Effect to Rust’s port traits, and show why the pattern that academics call ‘finally tagless’ is the same pattern that practitioners call ‘dependency injection.’

Syntax and Semantics 3. The Expression Problem

·6 mins
Adding a new type is easy in OOP, hard in FP. Adding a new operation is easy in FP, hard in OOP. Philip Wadler named this the Expression Problem in 1998. We show how it manifests in Rust and Scala, and tease the resolution.

Syntax and Semantics 2: Three ways to define what your code means

·7 mins
Your match expression is operational semantics. Your pure function is denotational semantics. Rust’s borrow checker is axiomatic semantics. Three formal frameworks, three ways to assign meaning to code, and you have been using all of them without knowing it.

Syntax and Semantics 1: Your code has a grammar problem

·6 mins
Every enum you write is a formal grammar. Every sealed trait is a set of production rules. You have been doing formal methods all along; you just did not know the name. We trace the connection from Chomsky’s hierarchy to your domain types in Rust and Scala.