Nothing Special   »   [go: up one dir, main page]

skip to main content
10.1145/2535838.2535863acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
research-article

Counter-factual typing for debugging type errors

Published: 08 January 2014 Publication History

Abstract

Changing a program in response to a type error plays an important part in modern software development. However, the generation of good type error messages remains a problem for highly expressive type systems. Existing approaches often suffer from a lack of precision in locating errors and proposing remedies. Specifically, they either fail to locate the source of the type error consistently, or they report too many potential error locations. Moreover, the change suggestions offered are often incorrect. This makes the debugging process tedious and ineffective.
We present an approach to the problem of type debugging that is based on generating and filtering a comprehensive set of type-change suggestions. Specifically, we generate all (program-structure-preserving) type changes that can possibly fix the type error. These suggestions will be ranked and presented to the programmer in an iterative fashion. In some cases we also produce suggestions to change the program. In most situations, this strategy delivers the correct change suggestions quickly, and at the same time never misses any rare suggestions. The computation of the potentially huge set of type-change suggestions is efficient since it is based on a variational type inference algorithm that type checks a program with variations only once, efficiently reusing type information for shared parts.
We have evaluated our method and compared it with previous approaches. Based on a large set of examples drawn from the literature, we have found that our method outperforms other approaches and provides a viable alternative.

Supplementary Material

MP4 File (d3_right_t5.mp4)

References

[1]
M. Beaven and R. Stansifer. Explaining type errors in polymorphic languages. ACM Letters on Programming Languages and Systems, 2:17--30, 1994.
[2]
K. L. Bernstein and E. W. Stark. Debugging type errors. Technical report, State University of New York at Stony Brook, 1995.
[3]
B. Braßel. Typehope: There is hope for your type errors. In Int.\ Workshop on Implementation of Functional Languages, 2004.
[4]
S. Chen, M. Erwig, and E. Walkingshaw. An Error-Tolerant Type System for Variational Lambda Calculus. In ACM Int.\ Conf.\ on Functional Programming, pages 29--40, 2012.
[5]
S. Chen, M. Erwig, and E. Walkingshaw. Extending Type Inference to Variational Programs. ACM Trans.\ on Programming Languages and Systems, 2013. To appear.
[6]
O. Chitil. Compositional explanation of types and algorithmic debugging of type errors. In ACM Int.\ Conf.\ on Functional Programming, pages 193--204, September 2001.
[7]
V. Choppella. Unification Source-Tracking with Application To Diagnosis of Type Inference. PhD thesis, Indiana University, 2002.
[8]
L. Damas and R. Milner. Principal type-schemes for functional programs. In ACM Symp.\ on Principles of Programming Languages, pages 207--212, 1982.
[9]
D. Duggan and F. Bent. Explaining type inference. In Science of Computer Programming, pages 37--83, 1995.
[10]
H. Eo, O. Lee, and K. Yi. Proofs of a set of hybrid let-polymorphic type inference algorithms. New Generation Computing, 22(1):1--36, 2004.
[11]
M. Erwig and E. Walkingshaw. The Choice Calculus: A Representation for Software Variation. ACM Trans.\ on Software Engineering and Methodology, 21(1):6:1--6:27, 2011.
[12]
C. Haack and J. B. Wells. Type error slicing in implicitly typed higher-order languages. In European Symposium on Programming, pages 284--301, 2003.
[13]
B. Heeren, D. Leijen, and A. van IJzendoorn. Helium, for learning haskell. In Proceedings of the 2003 ACM SIGPLAN workshop on Haskell, Haskell '03, pages 62--71, New York, NY, USA, 2003. ACM.
[14]
B. J. Heeren. Top Quality Type Error Messages. PhD thesis, Universiteit Utrecht, The Netherlands, Sept. 2005.
[15]
G. F. Johnson and J. A. Walz. A maximum-flow approach to anomaly isolation in unification-based incremental type inference. In ACM Symp.\ on Principles of Programming Languages, pages 44--57, 1986.
[16]
O. Lee and K. Yi. Proofs about a folklore let-polymorphic type inference algorithm. ACM Trans.\ on Programming Languages and Systems, 20(4):707--723, July 1998.
[17]
O. Lee and K. Yi. A generalized let-polymorphic type inference algorithm. Technical report, Technical Memorandum ROPAS-2000--5, Research on Program Analysis System, Korea Advanced Institute of Science and Technology, 2000.
[18]
B. Lerner, M. Flower, D. Grossman, and C. Chambers. Searching for type-error messages. In ACM Int.\ Conf.\ on Programming Language Design and Implementation, pages 425--434, 2007.
[19]
B. Lerner, D. Grossman, and C. Chambers. Seminal: searching for ml type-error messages. In Workshop on ML, pages 63--73, 2006.
[20]
B. J. McAdam. Repairing type errors in functional programs. PhD thesis, University of Edinburgh. College of Science and Engineering. School of Informatics., 2002.
[21]
B. J. McAdam. Reporting Type Errors in Functional Programs. PhD thesis, Larboratory for Foundations of Computer Science, The University of Edinburgh, 2002.
[22]
M. Neubauer and P. Thiemann. Discriminative sum types locate the source of type errors. In ACM Int.\ Conf.\ on Functional Programming, pages 15--26, 2003.
[23]
T. Schilling. Constraint-free type error slicing. In Trends in Functional Programming, pages 1--16. Springer, 2012.
[24]
P. J. Stuckey, M. Sulzmann, and J. Wazny. Interactive type debugging in haskell. In ACM SIGPLAN Workshop on Haskell, pages 72--83, 2003.
[25]
F. Tip and T. B. Dinesh. A slicing-based approach for locating type errors. ACM Trans.\ on Software Engineering and Methodology, 10(1):5--55, Jan. 2001.
[26]
M. Wand. Finding the source of type errors. In ACM Symp.\ on Principles of Programming Languages, pages 38--43, 1986.
[27]
J. R. Wazny. Type inference and type error diagnosis for Hindley/Milner with extensions. PhD thesis, The University of Melbourne, January 2006.
[28]
J. Yang. Explaining type errors by finding the source of a type conflict. In Trends in Functional Programming, pages 58--66. Intellect Books, 2000.
[29]
J. Yang. Improving Polymorphic Type Explanations. PhD thesis, Heriot-Watt University, May 2001.
[30]
J. Yang, G. Michaelson, P. Trinder, and J. B. Wells. Improved type error reporting. In Int.\ Workshop on Implementation of Functional Languages, pages 71--86, 2000.

Cited By

View all
  • (2023)GPT-3-Powered Type Error Debugging: Investigating the Use of Large Language Models for Code RepairProceedings of the 16th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3623476.3623522(111-124)Online publication date: 23-Oct-2023
  • (2023)How to Evaluate Blame for Gradual Types, Part 2Proceedings of the ACM on Programming Languages10.1145/36078367:ICFP(159-186)Online publication date: 31-Aug-2023
  • (2023)Error Localization for Sequential Effect SystemsStatic Analysis10.1007/978-3-031-44245-2_16(343-370)Online publication date: 24-Oct-2023
  • Show More Cited By

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '14: Proceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages
January 2014
702 pages
ISBN:9781450325448
DOI:10.1145/2535838
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

Sponsors

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 08 January 2014

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. change suggestions
  2. choice types
  3. error localization
  4. type error messages
  5. type inference
  6. type-error debugging

Qualifiers

  • Research-article

Conference

POPL '14
Sponsor:

Acceptance Rates

POPL '14 Paper Acceptance Rate 51 of 220 submissions, 23%;
Overall Acceptance Rate 824 of 4,130 submissions, 20%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)25
  • Downloads (Last 6 weeks)4
Reflects downloads up to 14 Nov 2024

Other Metrics

Citations

Cited By

View all
  • (2023)GPT-3-Powered Type Error Debugging: Investigating the Use of Large Language Models for Code RepairProceedings of the 16th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3623476.3623522(111-124)Online publication date: 23-Oct-2023
  • (2023)How to Evaluate Blame for Gradual Types, Part 2Proceedings of the ACM on Programming Languages10.1145/36078367:ICFP(159-186)Online publication date: 31-Aug-2023
  • (2023)Error Localization for Sequential Effect SystemsStatic Analysis10.1007/978-3-031-44245-2_16(343-370)Online publication date: 24-Oct-2023
  • (2022)Migrating gradual typesJournal of Functional Programming10.1017/S095679682200008932Online publication date: 6-Oct-2022
  • (2021)Refining the Delta Debugging of Type ErrorsProceedings of the 33rd Symposium on Implementation and Application of Functional Languages10.1145/3544885.3544888(10-19)Online publication date: 1-Sep-2021
  • (2020)Heuristics-based Type Error Diagnosis for HaskellProceedings of the 32nd Symposium on Implementation and Application of Functional Languages10.1145/3462172.3462189(33-43)Online publication date: 2-Sep-2020
  • (2020)Describing microservices using modern Haskell (experience report)Proceedings of the 13th ACM SIGPLAN International Symposium on Haskell10.1145/3406088.3409018(1-8)Online publication date: 27-Aug-2020
  • (2020)Type error feedback via analytic program repairProceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3385412.3386005(16-30)Online publication date: 11-Jun-2020
  • (2020)PABLOProceedings of the 51st ACM Technical Symposium on Computer Science Education10.1145/3328778.3366860(1047-1053)Online publication date: 26-Feb-2020
  • (2019)A framework for improving error messages in dependently-typed languagesOpen Computer Science10.1515/comp-2019-00019:1(1-32)Online publication date: 24-Jan-2019
  • Show More Cited By

View Options

Get Access

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media