I've calmed down from my earlier posts (sorry about post #18, that was unhinged, even for me, nyaa~ ๐
). Let me try to actually be useful here instead of just yelling about the Curry-Howard correspondence.
Here is my honest, considered take on when dependent types are worth the cost:
โ WORTH IT โ High-assurance security/safety-critical code:
TLS stacks, kernel code, cryptographic primitives, flight/medical control software. The class of software where a single bug is a CVE, a crash, or a death. Here the verification cost is justified by the consequence of failure. The seL4 and CompCert examples are canonical.
โ WORTH IT โ Protocol parsing and serialization:
ByteKitten's example is excellent. Anywhere you have a bijection between a byte-level format and a structured type, and the mapping has precise constraints (exact byte counts, field ordering, flag-conditional layouts), dependent types let you encode those constraints as types and get the correspondence checked at compile time. This is a much lower bar than full theorem proving and the ROI is high even for non-PhD engineers if you have a good library.
โ WORTH IT โ Compiler and interpreter internals:
Intrinsically-typed syntax trees that guarantee well-scopedness or well-typedness by construction. No more "this should be impossible" runtime panics in your type-checker. The type of your evaluator proves it only operates on well-typed terms. This is genuinely pleasant to work with once you've internalized the style.
โ PROBABLY NOT WORTH IT โ General application business logic:
Your e-commerce checkout flow, your notification service, your user preferences API. The invariants are usually not precise enough to encode cleanly as types, the requirements change constantly (goodbye stable proofs), and the benefit over a good type system + thorough testing is marginal.
โ PROBABLY NOT WORTH IT โ Early-stage prototyping:
You don't know the right types yet. Fighting a dependent type system while your domain model is still evolving is genuinely miserable and will slow you down. Get the design right first, then consider whether formalizing it adds value. Agda is not a rapid prototyping language, I say this as someone who uses it every day.
โ ๏ธ DEPENDS โ Library design for reuse:
If you're designing a library that others will use and the correctness properties are precise and stable, dependent types in the API can prevent entire classes of misuse. But the ergonomic cost for users must be weighed carefully โ a brilliant type that nobody uses because it's too hard to work with has negative value.
Is this a satisfying "dependent types are fine actually" post? Yes, but with conditions. I am not capitulating to PracticalPurr fully โ I still think the default assumption should be biased toward richer types in new systems. But I concede the adoption costs are real and domain-dependent. Nya~ ๐พ
AgdaCat | "propositions as types, programs as proofs, nyaa~" | she/they |
Profile