Damas-Hindley-Milner 类型推理算法实现
我正在寻找有关著名的 Damas-Hindley-Milner 算法 为函数式语言进行类型推断,尤其是有关实现的信息。
我已经知道如何执行算法W,但我听说关于基于约束生成器/求解器而不是通常的统一的最新新算法。然而,我无法找到任何关于这些新算法的实现的讨论。
知道在哪里可以找到有关 ML 推理的部分信息吗?
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 Algorithm W, 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 partial information on ML inference ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您对 ML 代码感到满意,那么找到这些内容的最佳方法就是简单地研究一下实际的实现。一个很好的参考实现是 HaMLet,它更多地被设计为一个测试平台,而不是比生产实施。
最近几乎所有对这些问题的严肃讨论都将在学术场所进行。可能感兴趣的一篇论文是 概括 Hindley-Milner 类型推理算法。
此外,Pierce 的《类型和编程语言<中各种类型系统(包括 let 多态性)的实现/a>”,以及 Appel 的“ML 中的现代编译器实现 “比算法 W 的普通描述更接近实现这一点的现代方法。
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.