TY - GEN
T1 - Diagnosing type errors with class
AU - Zhang, Danfeng
AU - Myers, Andrew C.
AU - Vytiniotis, Dimitrios
AU - Peyton-Jones, Simon
N1 - Publisher Copyright:
© 2015 ACM.
PY - 2015/6/3
Y1 - 2015/6/3
N2 - 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.
AB - 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.
UR - http://www.scopus.com/inward/record.url?scp=84951849440&partnerID=8YFLogxK
UR - http://www.scopus.com/inward/citedby.url?scp=84951849440&partnerID=8YFLogxK
U2 - 10.1145/2737924.2738009
DO - 10.1145/2737924.2738009
M3 - Conference contribution
AN - SCOPUS:84951849440
T3 - Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI)
SP - 12
EP - 21
BT - PLDI 2015 - Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation
A2 - Blackburn, Steve
A2 - Grove, David
PB - Association for Computing Machinery
T2 - 36th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2015
Y2 - 13 June 2015 through 17 June 2015
ER -