Elisabeth Stenholm’s presentation Dependent Types Are Everywhere! explores the significance of dependent types in programming, particularly within the context of questionnaire design. Elisabeth, drawing from her experience as a software developer, highlights how dependent types enhance code readability and robustness by enabling type definitions that are contingent on specific values, such as the dynamic length of lists and the constraints of user-defined data types like phone numbers. She illustrates the application of dependent types through modeling questionnaire flows where subsequent answers are influenced by prior responses, and describes her work with Idris 2, a dependently typed programming language, which supports these complex structures. Elisabeth emphasizes the advantages of compile-time checks in preventing common errors and the ongoing development of dependent types in languages like Haskell and Lean 4. She concludes by encouraging exploration of these concepts while inviting audience interaction and engagement in her community initiatives.
Dependent Types Are Everywhere!: A comprehensive overview
From insurance forms to Type Theory
The talk kicks off with a relatable developer anecdote: Elisabeth Stenholm, working on complex insurance questionnaires, found herself struggling with code readability and safety. A colleague’s offhand comment sparked a revelation — the difficulty lay not in the domain, but in the limitations of the programming language. Standard type systems just weren’t expressive enough.
That’s where dependent types come in.
What Are Dependent Types?
Dependent types allow a type to depend on a value. For example, rather than saying a function takes a list and an index, you can define a type that guarantees the index is within bounds. The compiler catches out-of-range errors at compile time, not after a customer hits “Submit“.
Elisabeth uses Idris 2, a dependently typed functional programming language, to demonstrate how these concepts apply in real life. She walks through an example where list indexing is made safe by encoding the list’s length directly into its type — a classic case where types go beyond just shapes and start enforcing actual logic.
Questionnaires as graphs
To illustrate real-world applicability, Elisabeth models insurance questionnaires as dependency graphs: questions can branch depending on answers, and answer types vary accordingly. For instance, answering “yes” to a driving question might lead to a location input, while “no” might prompt for a name. With dependent types, each path through the questionnaire has its own precise type, which means fewer bugs and better guarantees.
And no, it’s not as complicated as it sounds — Elisabeth showcases how even this logic can be expressed cleanly using inductive data types in Idris.
Validating user input with types
Another powerful example: enforcing phone number formats. With dependent types, you can define a type where valid phone numbers must start with a 4 or 9. If the input doesn’t match, it’s not just invalid — it literally doesn’t compile. Parsing user input still happens, of course, but once it’s in the system, you can trust it.
This isn’t just a gimmick. Elisabeth highlights how these guarantees scale to event-driven architectures as well, where different UI states expect different events. Instead of writing fragile code to cover all cases, you model the legal ones and let the compiler do the hard work.
Compile-time guarantees meet real-world UX
Elisabeth walks us through a live demonstration of a working questionnaire with runtime validation tied to compile-time safety. The system not only catches errors early but creates a clearer mental model for the developer.
This, she argues, is the magic of dependent types: bridging the gap between what we mean and what the code can guarantee.
When and why to use dependent types
Dependent types are especially valuable in:
- Security-critical applications
- Complex UIs with many conditional states
- Validation-heavy domains like insurance or finance
- Formal verification of mathematical theorems
But they’re not a silver bullet. Elisabeth is careful to point out that not every project needs them. Sometimes, simpler tools (like Haskell) are enough. But for the big, thorny problems? Dependent types might just be the tool you’ve been missing.