Advertisement

Guided Type Debugging

  • Sheng Chen
  • Martin Erwig
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8475)

Abstract

We present guided type debugging as a new approach to quickly and reliably remove type errors from functional programs. The method works by generating type-change suggestions that satisfy type specifications that are elicited from programmers during the debugging process. A key innovation is the incorporation of target types into the type error debugging process. Whereas previous approaches have aimed exclusively at the removal of type errors and disregarded the resulting types, guided type debugging exploits user feedback about result types to achieve better type-change suggestions. Our method can also identify and remove errors in type annotations, which has been a problem for previous approaches. To efficiently implement our approach, we systematically generate all potential type changes and arrange them in a lattice structure that can be efficiently traversed when guided by target types that are provided by programmers.

Keywords

Type debugging type inference error localization type error messages choice types change suggestions 

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Abraham, R., Erwig, M.: GoalDebug: A Spreadsheet Debugger for End Users. In: 29th IEEE Int. Conf. on Software Engineering, pp. 251–260 (2007)Google Scholar
  2. 2.
    Bernstein, K.L., Stark, E.W.: Debugging type errors. Technical report, State University of New York at Stony Brook (1995)Google Scholar
  3. 3.
    Braßel, B.: Typehope: There is hope for your type errors. In: Int. Workshop on Implementation of Functional Languages (2004)Google Scholar
  4. 4.
    Chen, S., Erwig, M.: Counter-Factual Typing for Debugging Type Errors. In: ACM Symp. on Principles of Programming Languages, pp. 583–594 (2014)Google Scholar
  5. 5.
    Chen, S., Erwig, M., Walkingshaw, E.: An Error-Tolerant Type System for Variational Lambda Calculus. In: ACM Int. Conf. on Functional Programming, pp. 29–40 (2012)Google Scholar
  6. 6.
    Chen, S., Erwig, M., Walkingshaw, E.: Extending Type Inference to Variational Programs. ACM Trans. on Programming Languages and Systems 36(1), 1–54 (2014)CrossRefGoogle Scholar
  7. 7.
    Chitil, O.: Compositional explanation of types and algorithmic debugging of type errors. In: ACM Int. Conf. on Functional Programming, pp. 193–204 (September 2001)Google Scholar
  8. 8.
    Chitil, O., Huch, F., Simon, A.: Typeview: A tool for understanding type errors. In: International Workshop on Implementation of Functional Languages, pp. 63–69 (2000)Google Scholar
  9. 9.
    Haack, C., Wells, J.B.: Type error slicing in implicitly typed higher-order languages. In: Degano, P. (ed.) ESOP 2003. LNCS, vol. 2618, pp. 284–301. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  10. 10.
    Hage, J.: Helium benchmark programs. Private Communication (2002-2005)Google Scholar
  11. 11.
    Hage, J., Heeren, B.: Heuristics for type error discovery and recovery. In: Horváth, Z., Zsók, V., Butterfield, A. (eds.) IFL 2006. LNCS, vol. 4449, pp. 199–216. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  12. 12.
    Heeren, B.J.: Top Quality Type Error Messages. PhD thesis, Universiteit Utrecht, The Netherlands (September 2005)Google Scholar
  13. 13.
    Johnson, G.F., Walz, J.A.: A maximum-flow approach to anomaly isolation in unification-based incremental type inference. In: ACM Symp. on Principles of Programming Languages, pp. 44–57 (1986)Google Scholar
  14. 14.
    Lerner, B., Flower, M., Grossman, D., Chambers, C.: Searching for type-error messages. In: ACM Int. Conf. on Programming Language Design and Implementation, pp. 425–434 (2007)Google Scholar
  15. 15.
    McAdam, B.J.: Repairing type errors in functional programs. PhD thesis, University of Edinburgh. College of Science and Engineering. School of Informatics (2002)Google Scholar
  16. 16.
    Neubauer, M., Thiemann, P.: Discriminative sum types locate the source of type errors. In: ACM Int. Conf. on Functional Programming, pp. 15–26 (2003)Google Scholar
  17. 17.
    Neubauer, M., Thiemann, P.: Haskell type browser. In: ACM SIGPLAN Workshop on Haskell, pp. 92–93 (2004)Google Scholar
  18. 18.
    Odersky, M., Läufer, K.: Putting type annotations to work. In: ACM Symp. on Principles of Programming Languages, pp. 54–67 (1996)Google Scholar
  19. 19.
    Schilling, T.: Constraint-free type error slicing. In: Peña, R., Page, R. (eds.) TFP 2011. LNCS, vol. 7193, pp. 1–16. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  20. 20.
    Stuckey, P.J., Sulzmann, M., Wazny, J.: Interactive Type Debugging in Haskell. In: ACM SIGPLAN Workshop on Haskell, pp. 72–83 (2003)Google Scholar
  21. 21.
    Stuckey, P.J., Sulzmann, M., Wazny, J.: Improving type error diagnosis. In: ACM SIGPLAN Workshop on Haskell, pp. 80–91 (2004)Google Scholar
  22. 22.
    Wand, M.: Finding the source of type errors. In: ACM Symp. on Principles of Programming Languages, pp. 38–43 (1986)Google Scholar
  23. 23.
    Wazny, J.R.: Type inference and type error diagnosis for Hindley/Milner with extensions. PhD thesis, The University of Melbourne (January 2006)Google Scholar
  24. 24.
    Yang, J., Michaelson, G., Trinder, P., Wells, J.B.: Improved type error reporting. In: Int. Workshop on Implementation of Functional Languages, pp. 71–86 (2000)Google Scholar
  25. 25.
    Zhang, D., Myers, A.C.: Toward General Diagnosis of Static Errors. In: ACM Symp. on Principles of Programming Languages, pp. 569–581 (2014)Google Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Sheng Chen
    • 1
  • Martin Erwig
    • 1
  1. 1.Oregon State UniversityCorvallisUSA

Personalised recommendations