Direct answer: Dependent types are types that can state claims about a program's behavior, such as 'a list of length exactly n', instead of only shapes like int or string. Through the Curry-Howard correspondence, a proof and a satisfying program are the same object, so the compiler can reject code that breaks its own promises.

Most software fails quietly at the seams: an empty list arrives where items were needed, or an index drifts past the end of an array. One school of programming languages argues those seams can be closed before the program ever runs, by letting the type system state the code's promises and a machine check each one.

The trending query The algebra of dependent types landed on the Hacker News front page with about 70 points in late November 2026, which is why it earns a closer read here. The aim is not to chase the spike but to find the durable idea underneath it, the kind of lesson that stays useful after the trend itself fades from the charts. That separation between velocity and value is the whole reason this post exists.

From shapes to claims

In an ordinary type system, a type describes the shape of data: an int is a whole number, a string is text, a list is a sequence of elements. Those shapes catch real mistakes but say nothing about content, so a function typed to accept any list will happily accept an empty one.

A dependent type closes the gap by letting a type depend on a value: you can write a type meaning 'a list whose length is exactly n', where n is part of the program itself. The compiler treats the claim as a checklist item, rejecting code that hands over the wrong length before it runs. The lesson is that types are algebra for promises: richer claims turn silent assumptions into checked facts.

Ordinary typechecks data shapeDependent typechecks claims tooCompiler verdictclaim holds or fails

Proofs are programs

The bridge that makes this work is the Curry-Howard correspondence, a result connecting logic and computation. A proposition, a statement that might be true, corresponds to a type, and a proof corresponds to a program of that type. Writing a function that satisfies the type is literally constructing a proof.

This works because constructive logic only accepts a claim when you show how: you cannot prove something exists without a way to produce it, and a program is exactly such a way. Proving a theorem and writing a satisfying function become the same act viewed from two directions. The lesson is that thinking it through and writing the code collapse when both are made of the same material.

Logic sideProgramming sideExample
PropositionType'list has length n'
ProofProgramfunction building the list
TheoremCompiled moduleverified parser
AssumptionFunction argumentthe value of n
missedyour Brain mapquiz yourselfmasteredWatch your weak spots turn green.

Drop in your PDF - it doesn't leave your device.
Every miss becomes a red node on your map.
Free plan: 21 nodes, no card, no countdown.

Open Brain - free

The trade-off: expressiveness costs effort

Languages built on this idea, Agda, Coq, Idris, and Lean among them, use dependent types to produce code whose compiler rejects incorrect claims about behavior. Writing such types is real work: you are proving small theorems on the way to shipping a feature, and that effort is the price of the guarantee.

The payoff is bugs that become impossible by construction rather than merely unlikely: a parser that cannot accept malformed input, an index that cannot walk off the end of an array. That is why the technique concentrates where being wrong is expensive, such as cryptographic libraries. The lesson is about choosing where to spend rigor: richer types trade writing effort for certainty.

Key takeaways

  • Ordinary types describe the shape of data; dependent types can state claims about values, such as a list of length exactly n.
  • The Curry-Howard correspondence maps propositions to types and proofs to programs, so proving and programming become one act.
  • Constructive logic demands a witness: proving something exists means producing it, which is what a program is.
  • Agda, Coq, Idris, and Lean turn the idea into practice, with compilers that reject code violating its claims.
  • The trade-off is effort: richer types cost more to write but make whole classes of bugs impossible by construction.

Quick answers

What is a dependent type?
A type that depends on a value, able to state claims like 'a list of length exactly n'.

What is the Curry-Howard correspondence?
The mapping of propositions to types and proofs to programs: a constructive proof is a working program.

Which languages use dependent types?
Agda, Coq, Idris, and Lean are the best-known examples.

Why not use them everywhere?
Richer types demand more effort, so they pay off where correctness matters most.

What bugs do they remove?
Whole classes, such as out-of-range indexes and malformed inputs, rejected at compile time.

One thing to do tonight

Pick one function you rely on and write down, in a single sentence, the claim it silently makes about its input. That sentence is the dependent type it deserves.