Affiliation:
1. University of California at San Diego, USA
2. University of Virginia, USA
Abstract
Static type errors are a common stumbling block for newcomers to typed functional languages. We present a dynamic approach to explaining type errors by generating counterexample witness inputs that illustrate how an ill-typed program goes wrong. First, given an ill-typed function, we symbolically execute the body to synthesize witness values that make the program go wrong. We prove that our procedure synthesizes general witnesses in that if a witness is found, then for all inhabited input types, there exist values that can make the function go wrong. Second, we show how to extend the above procedure to produce a reduction graph that can be used to interactively visualize and debug witness executions. Third, we evaluate the coverage of our approach on two data sets comprising over 4,500 ill-typed student programs. Our technique is able to generate witnesses for 88% of the programs, and our reduction graph yields small counterexamples for 81% of the witnesses. Finally, we evaluate whether our witnesses help students understand and fix type errors, and find that students presented with our witnesses show a greater understanding of type errors than those presented with a standard error message.
Funder
National Science Foundation
U.S. Air Force
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Cited by
12 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Total Type Error Localization and Recovery with Holes;Proceedings of the ACM on Programming Languages;2024-01-05
2. How to Evaluate Blame for Gradual Types, Part 2;Proceedings of the ACM on Programming Languages;2023-08-30
3. Applying cognitive principles to model-finding output: the positive value of negative information;Proceedings of the ACM on Programming Languages;2022-04-29
4. Novice Type Error Diagnosis with Natural Language Models;Programming Languages and Systems;2022
5. Refining the Delta Debugging of Type Errors;33rd Symposium on Implementation and Application of Functional Languages;2021-09