Heuristic compiler diagnostics cannot always localize type class errors; interactive visualization of type class resolution is feasible and with few interactions facilitates localization.
Programmers crave abstraction. Throughout the history of computing researchers and engineers have sought to manipulate data via higher-level abstractions. One such abstraction is polymorphism, the ability for a single symbol to represent a set of types. There are several flavors of polymorphism. Parametric polymorphism, a function parameterized by a type, which includes Java generic functions or C++ templates. Subtype polymorphism, operations can act over a set of types given they’re related by a notion of substitutatbility, a fancy way of saying object-oriented subtyping. Lastly, ad-hoc polymorphism, a set of functions and types that may have multiple concrete implementations, and the focus of this thesis.
Important Note The tool presented in this thesis, Argus, is open-source,
Overview
This dissertation has the following structure:
- The rest of this chapter introduces type classes as a language abstraction, important terminology for discussing the language of type classes, and a basic example.
- The following,
, introduces the structure of error diagnostics in Rust. Most important is our criteria for what distinguishes good and poor class diagnostics. The chapter finishes by demonstrating the connection between logic programming and type class systems, then proposing our solution to localize trait errors in Rust. - After establishing the foundation for why interactive debugging benefits type class systems, we talk about the implementation of our novel tool, Argus, that provides an interactive debugging interface into Rust’s trait system. We discuss the challenges and architecture of the tool as well as future plans for improvement. The chapter finishes by presenting our evaluation of the tool on a community curated test suite of hard-to-debug trait errors.
- We close with an informal look at the broader research area around interactive debugging, type error localization, and proof tree debugging.