CodeWa!
找到你要的答案

## Q：Damas-Hindley-Milner type inference algorithm implementation |
## Q：Damas Hindley Milner式的推理算法的实现 |

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 ? |
I'm looking for information about the well-known Damas-Hindley-Milner algorithm to do type inference for functional languages, especially information about implementation. 我已经知道如何做w-algorithm，但我听说最近新算法基于约束发电机/求解器而不是通常的统一。然而，我无法找到任何关于这些新算法的实现的讨论。 不知道我在哪儿能找到ML推断粒子的信息吗？ |

answer1： | 回答1： |

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. |
如果你对ML代码感到满意，找到这些东西的最好方法就是简单地看看野外的实现。一个很好的参考实现是哈姆雷特，它被设计成更多的测试平台，而不是一个生产实现。 几乎所有严重的最近讨论这些问题将是在学术场所。一纸可能感兴趣的是Generalising Hindley Milner式的推理算法。 同时，各种类型的系统的实现（包括让多态性）在Pierce的“类型和编程语言”，以及“Appel”ML现代编译器实现更接近现代的方法来实现这一算法的描述比香草 |

algorithm implementation type-inference hindley-milner |