This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: First-class Polymorphism with Type Inference Mark P. Jones Department of Computer Science, University of Nottingham, University Park, Nottingham NG7 2RD, England. [email protected] Abstract Languages like ML and Haskell encourage the view of values as first-class entities that can be passed as argu- ments or results of functions, or stored as components of data structures. The same languages offer paramet- ric polymorphism , which allows the use of values that behave uniformly over a range of different types. But the combination of these features is not supported— polymorphic values are not first-class. This restriction is sometimes attributed to the dependence of such lan- guages on type inference , in contrast to more expressive, explicitly typed languages, like System F, that do sup- port first-class polymorphism. This paper uses relationships between types and logic to develop a type system, FCP, that supports first-class polymorphism, type inference, and also first-class ab- stract datatypes. The immediate result is a more ex- pressive language, but there are also long term implica- tions for language design. 1 Introduction Programming languages gain flexibility and orthogonal- ity by allowing values to be treated as first-class enti- ties. Such values can be passed as arguments or results of functions, or be stored and retrieved as components of data structures. In functional languages, the for- mer often implies the latter; values are stored in a data structure by passing them as arguments to constructor functions, and retrieved using selector functions. In languages like ML  and Haskell , new types To appear in the Twenty Fourth Annual ACM SIGPLAN- SIGACT Symposium on Principles of Programming Languages, Paris, France, January 15-17, 1997. Copyright c 1997 by the Association for Computing Machinery, Inc. Permission to make digital or hard copies of part or all of this work for personal or class- room use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by oth- ers than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, to republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from Publications Dept., ACM Inc., Fax +1 (212) 869-0481, or h [email protected] i . of first-class value are specified by giving the names and types for their constructors. For example, a definition: data List a = Nil | Cons a ( List a ) introduces a new, unary type constructor, List , with two constructor functions: Nil :: ∀ a . List a Cons :: ∀ a . a → List a → List a ....
View Full Document
This note was uploaded on 02/13/2012 for the course CS 91.531 taught by Professor Giam during the Fall '09 term at UMass Lowell.
- Fall '09