# Generalizing Hindley-Milner Type Inference Algorithms

@inproceedings{Heeren2002GeneralizingHT, title={Generalizing Hindley-Milner Type Inference Algorithms}, author={Bastiaan Heeren and Jurriaan Hage and S. Doaitse Swierstra}, year={2002} }

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…

## 25 Citations

Type Processing by Constraint Reasoning

- Computer ScienceAPLAS
- 2006

This paper considers typing problems as constraint problems and shows which constraint algorithms are required to support various typing questions and uses a light weight constraint reasoning formalism, Constraint Handling Rules, to generate suitable algorithms for many popular extensions to Hindley/Milner types.

Scripting the type inference process

- Computer ScienceICFP '03
- 2003

It is shown how four techniques which influence the behaviour of constraint-based type inference processes can help to generate error messages which are conceptually closer to the domain for which the library was developed.

Constraint Based Type Inferencing in Helium

- Mathematics
- 2003

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…

Type inference and optimisation for an impure world

- Computer Science
- 2009

It is argued that it is more important for a compiler to be able to reason about the behaviour of a program, than for the language to be purely functional in a formal sense.

Parametric Type Inferencing for Helium

- Computer Science
- 2002

This paper documents the implementation of the Helium type inferencer, a compiler for a large subset of Haskell under development at Universiteit Utrecht, which can be parameterized in a number of ways.

Untangling Type Inference and Scope Analysis *

- 2011

Many modern functional programming languages support record types, parametric polymorphism and type inference. Allowing the same field name for two different records causes a problem in these…

Really Natural Linear Indexed Type Checking

- Computer Science, MathematicsIFL
- 2014

It is shown how to reduce type checking for (a simple extension of) DFuzz to constraint solving over a first-order theory of naturals and real numbers which, although undecidable, can often be handled in practice by standard numeric solvers.

Interactive type debugging in Haskell

- Computer ScienceHaskell '03
- 2003

This paper illustrates the facilities for type debugging of Haskell programs in the Chameleon programming environment with reasoning about constraint satisfiability and implication to find minimal justifications of type errors, and to explain unexpected types that arise.

Uniqueness Typing Redefined

- Computer ScienceIFL
- 2006

The type system of Clean is modified to allow for higher-rank types and to explicitly associate type constraints (attribute inequalities) with type schemes.

Explaining ML Type Errors by Data Flows

- Computer ScienceIFL
- 2004

We present a novel approach to explaining ML type errors: Since the type system inhibits data flows that would abort the program at run-time, our type checker identifies as explanations those data…

## References

SHOWING 1-10 OF 21 REFERENCES

On the unification of substitutions in type inference

- Computer Science
- 1999

A new operation is introduced which allows greater control over the use of substitutions so that this bias can be removed in type inference algorithms so that clearer error messages may then be produced.

A Generalization of Hybrid Let-Polymorphic Type Inference Algorithms

- Computer ScienceAPLAS
- 2000

We present a generalized let-polymorphic type inference algorithm, prove that any of its instances is sound and complete with respect to the Hindley/Milner let-polymorphic type system, and find a…

Explaining Type Inference

- Computer ScienceSci. Comput. Program.
- 1996

A modification of the unification algorithm used in Hindley-Milner type inference is presented, which allows the specific reasoning which led to a program variable having a particular type to be recorded for type explanation.

Hindley/Milner style type systems in constraint form

- Computer Science
- 1999

This papers presents a purely constraint{based formulation of Hindley/Milner style type systems which enjoys much nicer logical properties than previous approaches and presents a solution to the open problem of type inference in non-regular theories.

Correcting Errors in the Curry System

- Computer ScienceFSTTCS
- 1996

An interesting correspondence between the automaton constructed in Cox's method and a graphical representation of the term called sharing graphs is found, which allows us to read back a term from the maximal consistent subset of this set.

A Theory of Type Polymorphism in Programming

- Computer ScienceJ. Comput. Syst. Sci.
- 1978

This work presents a formal type discipline for polymorphic procedures in the context of a simple programming language, and a compile time type-checking algorithm w which enforces the discipline.

Proofs about a folklore let-polymorphic type inference algorithm

- Computer ScienceTOPL
- 1998

This article formally defines the context-sensitive, top-down type inference algorithm “<inline-equation>”, proves its soundness and completeness, and shows a distinguishing property that it always stops earlier than <inline-Equation> <f><sc>M</sc></f></inline- equation> if the input program is ill typed.

Debugging Type Errors (Full version)

- Computer Science
- 1995

It is argued that an extended type definition, which assigns types to open expressions as well as closed expressions, can serve as the basis for a programming environment that helps programmers debug type errors.

A maximum-flow approach to anomaly isolation in unification-based incremental type inference

- Computer SciencePOPL '86
- 1986

A language-based editor for a variant of ML that uses a novel approach to the isolation of likely causes of user errors that permits a new level of quality in the process of helping users when inputs are, for one reason or another, invalid.

Explaining type errors in polymorphic languages

- Computer ScienceLOPL
- 1993

This paper describes an approach that maintains the deductive steps of type inference and the reasons for type instantiations that could be used in an interactive system to guide the programmer to the source of a type error or to explain why the compiler assigned a particular type to an expression.