Join Nostr
2026-06-24 18:35:05 UTC

rntz on Nostr: class Expr a add: a × a → a lit: Int → a The type of expressions in this ...

class Expr a
add: a × a → a
lit: Int → a

The type of expressions in this language is definable by Church-encoding:

∀α. Expr α → α

Since Expr a ≅ Fa → a for Fa = Int+(a×a), this corresponds to initial F-algebras. But it's definable for *any* class C, not just for F-algebras. And it has a... dual?:

(1) ∀α. C α → α
(2) ∃α. C α × α

I'm used to thinking of (2) as OO "objects". But is this related to terminal coalgebras somehow? If so, how? Or is it a different sort of dual entirely?