Adding polymorphic abstraction to ML (detailed abstract)
Kfoury, A. J.
Wells, J. B.
MetadataShow full item record
Citation (published version)Kfoury, A.J.; Wells, J.B.. "Adding Polymorphic Abstraction to ML”, Technical Report BUCS-1994-006, Computer Science Department, Boston University, May 1994. [Available from: http://hdl.handle.net/2144/1465]
The ML programming language restricts type polymorphism to occur only in the "let-in" construct and requires every occurrence of a formal parameter of a function (a lambda abstraction) to have the same type. Milner in 1978 refers to this restriction (which was adopted to help ML achieve automatic type inference) as a serious limitation. We show that this restriction can be relaxed enough to allow universal polymorphic abstraction without losing automatic type inference. This extension is equivalent to the rank-2 fragment of system F. We precisely characterize the additional program phrases (lambda terms) that can be typed with this extension and we describe typing anomalies both before and after the extension. We discuss how macros may be used to gain some of the power of rank-3 types without losing automatic type inference. We also discuss user-interface problems in how to inform the programmer of the possible types a program phrase may have.