Skip to main content

Diagnosing type errors with class

Publication ,  Conference
Zhang, D; Myers, AC; Vytiniotis, D; Peyton-Jones, S
Published in: ACM SIGPLAN Notices
June 1, 2015

Type inference engines often give terrible error messages, and the more sophisticated the type system the worse the problem. We show that even with the highly expressive type system implemented by the Glasgow Haskell Compiler (GHC)-including type classes, GADTs, and type families-it is possible to identify the most likely source of the type error, rather than the first source that the inference engine trips over. To determine which are the likely error sources, we apply a simple Bayesian model to a graph representation of the typing constraints; the satisfiability or unsatisfiability of paths within the graph provides evidence for or against possible explanations. While we build on prior work on error diagnosis for simpler type systems, inference in the richer type system of Haskell requires extending the graph with new nodes. The augmentation of the graph creates challenges both for Bayesian reasoning and for ensuring termination. Using a large corpus of Haskell programs, we show that this error localization technique is practical and significantly improves accuracy over the state of the art.

Duke Scholars

Altmetric Attention Stats
Dimensions Citation Stats

Published In

ACM SIGPLAN Notices

DOI

ISSN

1523-2867

Publication Date

June 1, 2015

Volume

50

Issue

6

Start / End Page

12 / 21

Related Subject Headings

  • Software Engineering
 

Citation

APA
Chicago
ICMJE
MLA
NLM
Zhang, D., Myers, A. C., Vytiniotis, D., & Peyton-Jones, S. (2015). Diagnosing type errors with class. In ACM SIGPLAN Notices (Vol. 50, pp. 12–21). https://doi.org/10.1145/2737924.2738009
Zhang, D., A. C. Myers, D. Vytiniotis, and S. Peyton-Jones. “Diagnosing type errors with class.” In ACM SIGPLAN Notices, 50:12–21, 2015. https://doi.org/10.1145/2737924.2738009.
Zhang D, Myers AC, Vytiniotis D, Peyton-Jones S. Diagnosing type errors with class. In: ACM SIGPLAN Notices. 2015. p. 12–21.
Zhang, D., et al. “Diagnosing type errors with class.” ACM SIGPLAN Notices, vol. 50, no. 6, 2015, pp. 12–21. Scopus, doi:10.1145/2737924.2738009.
Zhang D, Myers AC, Vytiniotis D, Peyton-Jones S. Diagnosing type errors with class. ACM SIGPLAN Notices. 2015. p. 12–21.

Published In

ACM SIGPLAN Notices

DOI

ISSN

1523-2867

Publication Date

June 1, 2015

Volume

50

Issue

6

Start / End Page

12 / 21

Related Subject Headings

  • Software Engineering