Context-Dependent Type Error Diagnosis for Functional Languages

Alejandro Serrano, J. Hage

Research output: Book/ReportOther report

Abstract

Customizable type error diagnosis has been proposed as a solution toachieve domain-specific type error diagnosis for embedded domainspecific languages. A proven approach is to phrase type inferencingas a constraint-solving problem, so that we can manipulate the orderin which constraints are solved, and associate domain-specific typeerror messages with specific constraints to be communicated to theprogrammer in case type checking fails. A major challenge in thisarea lies in scaling this idea up uniformly to a fully-featured (functional)language, that is, languages that go beyond the polymorphicλ-calculus.In this paper, we show how within the general framework ConstraintHandling Rules we can achieve such uniformity and generality,while at the same time providing the necessary type errorcustomizability in a natural way. A proof-of-concept implementationis provided for a Haskell-like language, including support for typeclasses, GADTs and higher-ranked types. However, our approach appliesto any language for which a constraint-based non-backtrackingformulation of the type system is available.
Original languageEnglish
PublisherDepartment of Information and Computing Sciences, Utrecht University
Publication statusPublished - Nov 2016

Publication series

NameTechnical Report Series
No.UU-CS-2016-011
ISSN (Print)0924-3275

Keywords

  • Constraint Handling Rules
  • domain specific languages
  • custom error messages
  • type errors

Cite this