views:

69

answers:

1

I'm looking for information about the well-known Damas-Hindley-Milner algorithm to do type inference for functional languages, especially information about implementation.

I already know how to do the W-algorithm, but I heard about recent new algorithms based on constraint generator/solver rather than usual unification. However, I can't manage to find any discussions about the implementation of those new algorithm.

Any idea where I could find some partical information on ML inference ?

+4  A: 

If you're comfortable with ML code, the best way to find these things is to simply look into the implementations in the wild. A good reference implementation is HaMLet, which is designed as more of a test platform rather than a production implementation.

Almost all serious recent discussion of these issues is going to be in scholarly venues. One paper that might be of interest is Generalising Hindley-Milner type inference algorithms.

Also, the implementations of various type systems (including let polymorphism) in Pierce's "Types and Programming Languages", as well as Appel's "Modern Compiler Implementation in ML" more closely match modern approaches to implementing this than the vanilla description of algorithm W.

Gian
thanks for the ref to HaMLet, I didn't know such project existed !
Vinz
@Vinz, yep, it's pretty neat. It's tied up with some of the (seemingly defunct) work on successor ML.
Gian
I ran across this the other day - it relates Constraint Handling Rules with type inference with Type Classes: http://arxiv.org/abs/cs/0006034
Gian