Abstract
Type error messages of compilers of statically typed functional languages are often inaccurate, making type error debugging hard. Many solutions to the problem have been proposed, but most have been evaluated only with short programs, that is, of fewer than 30 lines. In this paper we note that our own tool for delta debugging type errors scales poorly for large programs. In response we present a new tool that applies a new algorithm for segmenting a large program before the delta debugging algorithm is applied. We propose a framework for quantifying the quality of type error debuggers and apply it to our new tool demonstrating substantial improvement.
J. Sharrad—PhD Student.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
With respect to the number of lines of the original ill-typed program.
- 2.
https://www.haskell.org/ghc, version 8.4.3.
- 3.
Removing single characters is another choice presented by Zeller [28].
- 4.
Instead of removing the lines completely we still keep the empty lines to avoid undesirable changes of program layout.
- 5.
This assumes similar run-time for every test, which may not be the case.
- 6.
A proof is available on page 408 of ‘Why Programs Fail’ [28].
- 7.
- 8.
- 9.
It should be noted when we talk about small programs in type error debugging we are discussing those that are used for evaluation and not those used for examples.
- 10.
{[1],[2], [3],[4],[5],[6],[7],[8],[9]} represents the non-moiety failing configuration. Every line is an acceptable splitting location.
- 11.
TcErrors is part of the Glasgow Haskell Compiler and states that type errors fall into one of 4 groups; more information about this can be found in: https://github.com/JoannaSharrad/ghcErrorsDoc/blob/master/RoughGuidetoGHCTcErrors.pdf.
- 12.
References
Artho, C.: Iterative delta debugging. STTT - Softw. Tools Technol. Transf. 13(3), 223–246 (2011). https://doi.org/10.1007/s10009-010-0139-9
Bernstein, K.L., Stark, E.W.: Debugging type errors. Technical report, November 1995
Chen, S., Erwig, M.: Counter-factual typing for debugging type errors. In: Jagannathan, S., Sewell, P. (eds.) POPL 2014, pp. 583–594. ACM (2014)
Chen, S., Erwig, M.: Guided type debugging. In: Codish, M., Sumii, E. (eds.) FLOPS 2014. LNCS, vol. 8475, pp. 35–51. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-07151-0_3
Chitil, O.: Compositional explanation of types and algorithmic debugging of type errors. In: Pierce, B.C. (ed.) ICFP 2001, pp. 193–204. ACM (2001)
Cleve, H., Zeller, A.: Locating causes of program failures. In: Roman, G., Griswold, W.G., Nuseibeh, B. (eds.) 27th International Conference on Software Engineering, pp. 342–351. ACM (2005)
Haack, C., Wells, J.B.: Type error slicing in implicitly typed higher-order languages. Sci. Comput. Program. 50(1–3), 189–224 (2004)
Kalhauge, C.G., Palsberg, J.: Binary reduction of dependency graphs. In: Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering, pp. 556–566. ACM (2019)
Lerner, B.S., Grossman, D., Chambers, C.: Seminal: searching for ML type-error messages. In: Proceedings of the ACM Workshop on ML, pp. 63–73 (2006)
McAdam, B.J.: On the unification of substitutions in type inference. In: Hammond, K., Davie, T., Clack, C. (eds.) IFL 1998. LNCS, vol. 1595, pp. 137–152. Springer, Heidelberg (1999). https://doi.org/10.1007/3-540-48515-5_9
Misherghi, G., Su, Z.: HDD: hierarchical delta debugging. In: ICSE 2006, pp. 142–151. ACM (2006)
Misherghi, G.S., HDD, Z.S.: Hierarchical delta debugging. Ph.D. thesis, University of California, Davis (2007). https://pdfs.semanticscholar.org/a337/e5ba5b18cc45fd4517b90c5ac92e8052b6d3.pdf
Rahli, V., Wells, J.B., Pirie, J., Kamareddine, F.: Skalpel: a type error slicer for standard ML. Electron. Notes Theor. Comput. Sci. 312, 197–213 (2015)
Regehr, J., Chen, Y., Cuoq, P., Eide, E., Ellison, C., Yang, X.: Test-case reduction for C compiler bugs. In: PLDI 2012, pp. 335–346. ACM (2012)
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). https://doi.org/10.1007/978-3-642-32037-8_1
Seidel, E.L., Jhala, R., Weimer, W.: Dynamic witnesses for static type errors (or, ill-typed programs usually go wrong). In: ICFP 2016, pp. 228–242. ACM (2016)
Seidel, E.L., Sibghat, H., Chaudhuri, K., Weimer, W., Jhala, R.: Learning to blame: Localizing novice type errors with data-driven diagnosis. CoRR abs/1708.07583 (2017). http://arxiv.org/abs/1708.07583
Sharrad, J., Chitil, O., Wang, M.: Delta debugging type errors with a blackbox compiler. In: IFL 2018, pp. 13–24. ACM (2018)
Shung, K.P.: Accuracy, precision, recall or f1? November 2019. https://towardsdatascience.com/accuracy-precision-recall-or-f1-331fb37c5cb9
Stuckey, P.J., Sulzmann, M., Wazny, J.: Interactive type debugging in Haskell. In: Proceedings of the ACM SIGPLAN Workshop on Haskell, pp. 72–83. ACM (2003)
Stuckey, P.J., Sulzmann, M., Wazny, J.: Improving type error diagnosis. In: Nilsson, H. (ed.) Workshop on Haskell 2004, pp. 80–91. ACM (2004). https://doi.org/10.1145/1017472.1017486
Tip, F., Dinesh, T.B.: A slicing-based approach for locating type errors. ACM Trans. Softw. Eng. Methodol. 10(1), 5–55 (2001)
Tsushima, K., Asai, K.: An embedded type debugger. In: Hinze, R. (ed.) IFL 2012. LNCS, vol. 8241, pp. 190–206. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-41582-1_12
Tsushima, K., Chitil, O.: Enumerating counter-factual type error messages with an existing type checker. In: PPL 2014 (2014)
Wand, M.: Finding the source of type errors. In: POPL 1986, pp. 38–43. ACM (1986)
Witten, I., Frank, E.: Data Mining: Practical Machine Learning Tools and Techniques. Morgan Kaufmann, Burlington (2005)
Zeller, A.: Yesterday, my program worked. Today, it does not. Why? In: Nierstrasz, O., Lemoine, M. (eds.) ESEC/SIGSOFT FSE -1999. LNCS, vol. 1687, pp. 253–267. Springer, Heidelberg (1999). https://doi.org/10.1007/3-540-48166-4_16
Zeller, A.: Why Programs Fail Guide to Systematic Debugging, 2nd edn. Academic Press, Cambridge (2009)
Zeller, A., Hildebrandt, R.: Simplifying and isolating failure-inducing input. IEEE Trans. Softw. Eng. 28(2), 183–200 (2002)
Zhang, D., Myers, A.C., Vytiniotis, D., Peyton Jones, S.L.: Diagnosing type errors with class. In: Grove, D., Blackburn, S. (eds.) PLDI 2015, pp. 12–21. ACM (2015)
Acknowledgements
We would like to thank all of the reviewers for their thorough feedback, which we incorporated into this paper.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Sharrad, J., Chitil, O. (2020). Scaling Up Delta Debugging of Type Errors. In: Byrski, A., Hughes, J. (eds) Trends in Functional Programming. TFP 2020. Lecture Notes in Computer Science(), vol 12222. Springer, Cham. https://doi.org/10.1007/978-3-030-57761-2_4
Download citation
DOI: https://doi.org/10.1007/978-3-030-57761-2_4
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-57760-5
Online ISBN: 978-3-030-57761-2
eBook Packages: Computer ScienceComputer Science (R0)