Diagnosing type errors with class

@article{Zhang2015DiagnosingTE,
  title={Diagnosing type errors with class},
  author={Danfeng Zhang and Andrew C. Myers and Dimitrios Vytiniotis and S. Peyton-jones},
  journal={Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation},
  year={2015}
}
  • Danfeng Zhang, A. Myers, S. Peyton-jones
  • Published 3 June 2015
  • Computer Science
  • Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and Implementation
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… 

Figures from this paper

A practical framework for type inference error explanation
TLDR
This work shows how to produce correcting set-based error reports by leveraging existing type inference implementations, easing the burden of adoption and, as type inference algorithms tend to be efficient in practice, producing error reports of comparable quality to similar error reporting tools orders of magnitude faster.
Learning user friendly type-error messages
TLDR
L Learnskell is a type error debugger that uses machine learning to help diagnose and deliver high quality error messages, for programs that contain nonstructural errors, and it is found that it scales to large programs.
Skalpel: A constraint-based type error slicer for Standard ML
Sound, heuristic type annotation inference for Ruby
TLDR
InferDL, a novel Ruby type inference system that infers sound and useful type annotations by incorporating heuristics that guess types, is introduced and believed to represent a promising approach for inferring type annotations in dynamic languages.
Practical SMT-based type error localization
TLDR
A new algorithm is presented that efficiently finds an optimal error source in a given ill-typed program by using an improved SMT encoding to cope with the high complexity of polymorphic typing by iteratively expanding the typing constraints from which principal types are derived.
Decrypting Local Type Inference
TLDR
This thesis designs an algorithm that backtracks through the nodes of type derivation trees in order to discover the typing decisions that introduce the types for the first time during the type inference process, and is the first to address the problem of type errors for programming languages that use local type inference.
Context-Dependent Type Error Diagnosis for Functional Languages
TLDR
This paper shows how within the general framework Constraint Handling Rules the authors can achieve uniformity and generality, while at the same time providing the necessary type error customizability in a natural way, within a Haskell-like language.
SHErrLoc: A Static Holistic Error Locator
TLDR
The results show that when compared to existing compilers and other tools, SHErrLoc consistently identifies the location of programmer errors significantly more accurately, without any language-specific heuristics.
Systematic identification and communication of type errors*
TLDR
Counter-factual typing is developed, which finds a comprehensive set of error causes in AST leaves, computes an informative message on how to get rid of the type error for each error cause, and ranks all messages and iteratively presents the message for the most likely error cause.
...
1
2
3
...

References

SHOWING 1-10 OF 44 REFERENCES
Diagnosing Haskell Type Errors
TLDR
It is shown that even with highly expressive type system implemented by the Glasgow Haskell Compiler—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.
Heuristics for Type Error Discovery and Recovery
TLDR
This work forms type inference as a constraint problem, and analyzes the collected constraints to improve the error messages and, as a result, programming efficiency.
Searching for type-error messages
TLDR
This work pursues a new approach to constructing compilers and presenting type-error messages in which the type-checker itself does not produce the messages, and is an oracle for a search procedure that finds similar programs that do type-checking.
Top quality type error Messages
TLDR
This thesis is entirely devoted to improve the type error messages for a functional programming language, and proposes a set of type inference directives to personalize the type inference process even further.
Toward general diagnosis of static errors
TLDR
A general way to locate programmer mistakes that are detected by static analyses such as type checking, and the results show that the general technique identifies the location of programmer errors significantly more accurately.
Finding Minimum Type Error Sources
TLDR
The approach works by reducing the search for minimum error sources to an optimization problem that is formulated in terms of weighted maximum satisfiability modulo theories (MaxSMT), which allows it to build on SMT solvers to support rich type systems and at the same time abstract from the concrete criterion that is used for ranking the error sources.
OutsideIn(X) Modular type inference with local assumptions
TLDR
This paper characterises the properties of the constraint solver for X so that the resulting algorithm only accepts programs with principal types, even when the type system specification accepts programs that do not enjoy principal types.
Practical type inference for arbitrary-rank types
TLDR
This paper presents a complete type-inference engine, written in Haskell, for a traditional Damas-Milner type system, and shows how to extend it for higher-rank types.
Counter-factual typing for debugging type errors
TLDR
This work presents an approach to the problem of type debugging that is based on generating and filtering a comprehensive set of type-change suggestions and finds that it outperforms other approaches and provides a viable alternative.
On the unification of substitutions in type inference
TLDR
A new operation is introduced which allows greater control over the use of substitutions so that this bias can be removed in type inference algorithms so that clearer error messages may then be produced.
...
1
2
3
4
5
...