Skip to main content

Type Debugging with Counter-Factual Type Error Messages Using an Existing Type Checker

Tsushima, Kanae, Chitil, Olaf, Sharrad, Joanna (2020) Type Debugging with Counter-Factual Type Error Messages Using an Existing Type Checker. In: IFL '19: Proceedings of the 31st Symposium on Implementation and Application of Functional Languages. ICPS . ACM, New York, NY, USA ISBN 978-1-4503-7562-7. (doi:10.1145/3412932.3412939) (KAR id:81976)

PDF Author's Accepted Manuscript
Language: English
Download (894kB) Preview
[thumbnail of paper.pdf]
This file may not be suitable for users of assistive technology.
Request an accessible format
Official URL:


The cause of a type error can be very difficult to find for the Hindley-Milner type system. Consequently many solutions have been proposed, but they are hardly used in practice. Here we propose a new solution that provides counter-factual type error messages; these messages state what types specific subexpressions in a program should have (in contrast to the types they actually have) to remove a type error. Such messages are easy-to-understand, because

programers are already familiar with them. Furthermore, our solution is easy-to-implement, because it reuses an existing type checker as a subroutine. We transform an ill-typed program into a well-typed program with additional λ-bound variables. The types of these λ-bound variables yield actual and counter-factual type information. That type information plus intended types added as type annotations direct the search of the type debugger.

Item Type: Conference or workshop item (Proceeding)
DOI/Identification number: 10.1145/3412932.3412939
Uncontrolled keywords: Hindley-Milner type system, OCaml
Subjects: Q Science > QA Mathematics (inc Computing science) > QA 76 Software, computer programming,
Divisions: Divisions > Division of Computing, Engineering and Mathematical Sciences > School of Computing
Depositing User: Olaf Chitil
Date Deposited: 03 Jul 2020 11:23 UTC
Last Modified: 14 Nov 2022 23:10 UTC
Resource URI: (The current URI for this page, for reference purposes)
Tsushima, Kanae:
Chitil, Olaf:
Sharrad, Joanna:
  • Depositors only (login required):


Downloads per month over past year