A logical algorithm for ML type inference
暂无分享,去创建一个
This paper gives a bottom-up logic programming formulation of the Hindley-Milner polymorphic type inference algorithm. We show that for programs of bounded order and arity the given algorithm runs in O(na(n) + dn) time where n is the length of the program, d is the scheme depth of the program, and a is the inverse of Ackermann's function. It is argued that for practical programs d will not exceed 5 even for programs with hundreds of module layers. This formulation of the Hindley-Milner algorithm is intended as a case study in logical algorithms, i.e., algorithms presented and analyzed as bottom-up inference rules.