@MISC{Hammond91efficienttype, author = {Kevin Hammond}, title = {Efficient Type Inference Using Monads}, year = {1991} }

Bookmark

OpenURL

Abstract

Efficient type inference algorithms are based on graph-rewriting techniques. Consequently, at first sight they seem unsuitable for functional language implementation. In fact, most compilers written in functional languages use substitution-based algorithms, at a considerable cost in performance. In this paper, we show how monads may be used to transform a substitution-based inference algorithm into one using a graph representation. The resulting algorithm is faster than the corresponding substitutionbased algorithm. Monads are also used to develop a parallel substitution inference algorithm. Practical considerations limit the development of a parallel graph-rewriting algorithm in a functional language. 1 Introduction Type inference accounts for much of the cost of compiling a functional program. Typically around half of the total space and time requirements of a compilation in the Glasgow prototype Haskell compiler, or the Chalmers LML compiler can be attributed directly to the costs o...