Paper: [pdf] (© Copyright 2004, Springer-Verlag)
(To appear in the Proceedings of PADL 2005)
Slides: [pdf]
Abstract:
The goal of this paper is to improve the type error messages in the presence of
Haskell 98 type classes, in particular for the non-expert user.
As a language feature, type classes are very pervasive, and strongly influence what
is reported and when, even in relatively simple programs.
We propose four type class directives, and specialized type rules,
to lend high-level support to compilers to improve the type error messages.
Both have been implemented, and can be used to easily modify the
behavior of the type inference process.
Technical Report: (UU-CS-2004-039) [pdf] [bib]
Abstract:
Building on earlier work on type inference directives for scripting
a compiler to improve type error messages, we present
extensions to those directives to deal with type classes.
Our work is mainly motivated by the need for better type error messages,
especially for domain specific languages. Type inference directives
can bridge the gap between embedded domain specific languages
and Haskell by their ability to lift
error messages to the conceptual level of the domain, without a need to
know anything about how the compiler works on the inside.
We consider both special type class directives, which help to improve type error messages in the presence of type classes, and we show how existing type inference directives can be extended to cope with overloading. We also describe a heuristic where type class information is used to pinpoint more precisely the most likely source of a unification error in a program.
An updated version of this technical report will appear in PADL 2005.
8th ACM SIGPLAN International Conference on Functional Programming (ICFP 2003)
Uppsala, Sweden, 25-27 August 2003
[ps]
[pdf]
[bib]
(© Copyright 2003, ACM)
Slides: [pdf]
Abstract:
To improve the quality of type error messages in functional programming languages,
we propose four techniques which influence the behaviour of
constraint-based type inference processes. These techniques take
the form of externally supplied type inference directives,
precluding the need to make any changes to the compiler.
A second advantage is that the directives are automatically checked for
soundness with respect to the underlying type system.
We show how the techniques can be used to improve the type error messages
reported for a combinator library. More specifically, how they can help to generate
error messages which are conceptually closer to the domain for which the
library was developed.
The techniques have all been incorporated in the Helium compiler, which
implements a large subset of Haskell.
ACM SIGPLAN 2003 Haskell Workshop
Uppsala, Sweden, August 28, 2003
[ps]
[pdf]
[bib]
(© Copyright 2003, ACM)
Abstract:
Helium is a user-friendly compiler designed especially for learning the functional programming language Haskell.
The quality of the error messages has been the main concern both in the choice of the language features and in the
implementation of the compiler.
Helium implements almost full Haskell, where the most notable difference is the
absence of type classes. Our goal is to let students learn functional programming more quickly and with more fun.
The compiler has been successfully employed in two introductory programming courses at Utrecht University.
The CP-03 Workshop on Immediate Applications of Constraint Programming
Cork, Ireland, September 29, 2003
[ps]
[pdf]
[bib]
Abstract:
The Helium compiler implements a significant subset of the
functional programming language Haskell. One of the major motivations for
developing it was to yield understandable and appropriate type
error messages. The separation between the generation, the ordering and
the solving of constraints on types has led to a flexible framework which
has been employed successfully in a classroom setting.
Among its many advantages are the possibility to plug in heuristics
for deciding the most likely source of a type error, the generation of multiple
type error messages during a single compilation, and the possibility
for programmers to tune the type inference process and resulting messages
to their own needs without having to know any of the details of the
implementation.
Technical Report: (UU-CS-2002-035) [pdf] [bib]
Slides: (presented at IFL 2002) [pdf]
Abstract:
Helium is a compiler for a large subset of Haskell under development at
Universiteit Utrecht. A major design criterion is the ability to give superb
error messages. This is especially needful for novice functional programmers. In
this paper we document the implementation of the Helium type inferencer. For
purposes of experimentation with various methods of type inferencing, the type
inferencer can be parameterized in a number of ways. Among the instances we find
not only standard algorithms such as M and W, but also more global type
inferencers based on type graphs.
See Constraint Based Type Inferencing in Helium for an updated version of this paper.
Technical Report: (UU-CS-2002-031) [pdf] [bib]
Abstract:
Type inferencing according to the standard algorithms W and M often yields
uninformative error messages. Many times, this is a consequence of a bias
inherent in the algorithms. The method developed here is to first collect
constraints from the program, and to solve these afterwards, possibly under the
influence of a heuristic. We show the soundness and completeness of our
algorithm. The algorithms W and M turn out to be deterministic instances of our
method, giving the correctness for W and M with respect to the Hindley-Milner
typing rules for free. We also show that our algorithm is more flexible, because
it naturally allows the generation of multiple messages.
Technical Report: (UU-CS-2002-009) [pdf] [bib]
Masters Thesis: (University of Utrecht, INF/SCR-00-14) [pdf]
Abstract:
Type systems are indispensable in modern higher-order, polymorphic languages.
An important explanation for Haskell's and ML's popularity is their advanced
type system, which helps a programmer in finding program errors before the
program is run. Although the type system in a polymorphic language is important,
the reported error messages are often poor. The goal of this research is to
improve the quality of error messages for ill-typed expressions.
In a unification-based system type conflicts are often detected far from the source of the conflict. To indicate the actual source of a type conflict an analysis of the complete program is necessary. For example, if there are three occurrences where x::Int and only one where x::Bool, we expect that there is something wrong with the occurrence of x::Bool. The order in which subexpressions occur should not influence the reported error. Unfortunately, this is not the case for unification-based systems.
This article presents another approach to inferring the type of an expression. A set of typing rules is given together with a type assignment algorithm. From the rules and the program at hand we construct a set of constraints on types. This set replaces the unification of types in a unification-based system. If the set is inconsistent, some constraints are removed from the set and error messages are constructed. Several heuristics are used to determine which constraint is to be removed. With this approach we increase the chance that the actual source of a type conflict is reported. As a result we are able to produce more precise error messages.
Verschenen in Informatie, oktober 2004, jaargang 46/8
[pdf]
[bib]
Samenvatting:
De auteurs doen onderzoek naar compilers die precieze en gebruikersvriendelijke foutmeldingen genereren, voor ondersteuning van onderwijs in programmeren. Samen met anderen ontwikkelden zij Helium, een compiler voor Haskell. Helium gaat uit van een aantal goede gewoontes en levert suggesties bij een aantal veel voorkomende fouten.
Te verschijnen in de proceedings van NIOC 2004. [pdf] [bib]
Samenvatting:
Moderne functionele talen zijn mathematisch precies, notationeel elegant, en sterk getypeerd.
Deze talen zijn daarom bij uitstek geschikt voor het onderwijzen van programmeerconcepten en
algoritmiek. Helium is een onderzoeksproject waarbij een krachtig typesysteem gecombineerd wordt
met precieze en gebruiksvriendelijke foutmeldingen.