## First-class Polymorphism with Type Inference (0)

### Cached

### Download Links

- [www-internal.cse.ogi.edu]
- [www-internal.cse.ogi.edu]
- CiteULike
- DBLP

### Other Repositories/Bibliography

Citations: | 47 - 0 self |

### BibTeX

@MISC{Jones_first-classpolymorphism,

author = {Mark P. Jones},

title = {First-class Polymorphism with Type Inference},

year = {}

}

### Years of Citing Articles

### OpenURL

### Abstract

Languages like ML and Haskell encourage the view of values as first-class entities that can be passed as arguments or results of functions, or stored as components of data structures. The same languages o#er parametric polymorphism, which allows the use of values that behave uniformly over a range of di#erent 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 languages on type inference, in contrast to more expressive, explicitly typed languages, like System F, that do support 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 abstract datatypes. The immediate result is a more expressive language, but there are also long term implications for language design. 1

### Citations

1562 | The Definition of Standard ML
- Miller, Tofte, et al.
- 1990
(Show Context)
Citation Context ...nguages, the former 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 =-=[20]-=- and Haskell [8], new types To appear in the Twenty Fourth Annual ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, Paris, France, January 15-17, 1997. Copyright c fl 1997 by the Ass... |

945 |
A machine-oriented logic based on the resolution principle
- Robinson
- 1965
(Show Context)
Citation Context ...hat term. This is important because it allows programmers to take advantage of the expressiveness of FCP, without giving up on the convenience of type inference. 5.1 Unification As usual, unification =-=[30]-=- plays a central role in the type inference process. Given two typessands0 , the goal of a unification algorithm is to find the most general substitution U such that Us= Us0 . In this paper, we use a ... |

936 | A theory of type polymorphism in progra.mming
- Milner
- 1978
(Show Context)
Citation Context ...n the lists concerned. Indeed, examples like these are often used to illustrate the flexibility of polymorphic type systems. An important property of languages based on the Hindley-Milner type system =-=[6, 19]-=- is that most general, or principal, types for functions like these can be inferred automatically from the types of the constructors Nil and Cons. There is no need for further type annotations. At the... |

536 |
The Implementation of Functional Programming Languages
- Jones
- 1987
(Show Context)
Citation Context ... be treated as syntactic sugar for ((K z ):E 0 ) E . Pattern matching against values from datatypes with multiple constructors can be described using a `fatbar' operator, as described by Peyton Jones =-=[25]-=-. The type checking rules for FCP are again justified by appealing to the underlying logic, as explained in Section 2.2. The actual derivations are complicated by the presence of both existential and ... |

441 |
The formulae-as-types notion of construction
- Howard
- 1980
(Show Context)
Citation Context ...condition that x does not appear free in P : (8x :P ) Q) = P ) (8x :Q) (1) (8x :Q ) P) = (9x :Q) ) P (2) (9x :P ) Q) = P ) (9x :Q) (3) (9x :Q ) P) = (8x :Q) ) P (4) Using the Curry-Howard isomorphism =-=[7]-=- as a bridge between logic and type theory, we can use Equation 1 to justify the equivalence: (8a:8x :T a !s) = 8a:T a ! (8x : ) : This result tells us that we can convert an arbitrary term of one typ... |

364 |
Towards a theory of type structure
- Reynolds
- 1974
(Show Context)
Citation Context ...ticular monomorphic instances of polymorphic values to and from functions, rather than the polymorphic values themselves. On the other hand, comparisons with explicitly typed languages, like System F =-=[4, 29]-=-, that do support first-class polymorphism, reveal significant differences in expressiveness. We will see a number of practical examples in later sections that use first-class polymorphism in essentia... |

345 | How to make ad-hoc polymorphism less ad hoc
- Wadler, Blott
- 1989
(Show Context)
Citation Context ...a \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma Figure 12: Extensions of Hindley-Milner typing Type class overloading, in the form described by Kaes [13], and Wadler and Blott =-=[33]-=-, was probably the first of these three extensions to be incorporated in a widely used programming language. The semantics of the system of type classes in the paper by Wadler and Blott was explained ... |

292 |
Abstract types have existential types
- Mitchell, Plotkin
- 1985
(Show Context)
Citation Context ...tential quantifiers in the types of datatype components. The former provides support for first-class polymorphism, while the latter can be used to deal with examples of first-class abstract datatypes =-=[21]-=- in the style suggested by Perry [23] and refined by Laufer [14, 16]. The main subjects covered in the remaining sections of this paper are as follows: ffl Section 2 shows how ideas from logic can be ... |

233 | Monad Transformers and Modular Interpreters
- Liang, Hudak, et al.
- 1995
(Show Context)
Citation Context ...tation, to provide a typesafe representation for monads [32] as first-class values. Much has been achieved using constructor class overloading [11] to explore the use of monads and monad transformers =-=[2, 18]-=-. As this example suggests, the same experiments can be repeated in FCP by packaging these items up as first-class values. In fact, FCP has exactly the features needed to describe the implementation o... |

229 |
Une extension de l’interprétation de Gödel à l’analyse et son application à l’élimination de coupures dans l’analyse et la théorie des types
- Girard
- 1971
(Show Context)
Citation Context ...ticular monomorphic instances of polymorphic values to and from functions, rather than the polymorphic values themselves. On the other hand, comparisons with explicitly typed languages, like System F =-=[4, 29]-=-, that do support first-class polymorphism, reveal significant differences in expressiveness. We will see a number of practical examples in later sections that use first-class polymorphism in essentia... |

195 | A short cut to deforestation
- Gill, Launchbury, et al.
- 1993
(Show Context)
Citation Context ...elf push' pop top empty) = Stack (push' x self) push' pop top empty top :: Stack a -? a top (Stack self push pop top' empty) = top' self testExpr :: [Int] testExpr = map (top . push 1) [makeListStack =-=[1,2,3]-=-, makeListStack [4,5]] Figure 5: A simple encoding of stack packages tion, hidden by an existential quantifier. Note that our prototype implementation adopts the convention that variables beginning wi... |

178 | A system of constructor classes: overloading and implicit higher-order polymorphism
- Jones
- 1993
(Show Context)
Citation Context ...P and higher-order polymorphism in our prototype implementation, to provide a typesafe representation for monads [32] as first-class values. Much has been achieved using constructor class overloading =-=[11]-=- to explore the use of monads and monad transformers [2, 18]. As this example suggests, the same experiments can be repeated in FCP by packaging these items up as first-class values. In fact, FCP has ... |

158 | Simple type-theoretic foundations for object-oriented programming
- Pierce, Turner
- 1994
(Show Context)
Citation Context ...leans and Church numerals, a facility for using monads [32] as first-class values, a treatment of stacks as abstract datatypes, and the Pierce-Turner representation of objects using existential types =-=[27]-=-. These examples have been tested using a prototype implementation of FCP developed by the author. ffl Section 4 gives a formal definition of FCP, including the treatment of special syntax for constru... |

142 |
The principal type-scheme of an object in combinatory logic
- Hindley
- 1969
(Show Context)
Citation Context ...n the lists concerned. Indeed, examples like these are often used to illustrate the flexibility of polymorphic type systems. An important property of languages based on the Hindley-Milner type system =-=[6, 19]-=- is that most general, or principal, types for functions like these can be inferred automatically from the types of the constructors Nil and Cons. There is no need for further type annotations. At the... |

106 | Lazy functional state threads
- Launchbury, Jones
- 1994
(Show Context)
Citation Context ...ed in more general ways than our current focus on datatypes and constructor functions might suggest. For example, our framework could also be used to type Launchbury and Peyton Jones' runST construct =-=[17]-=-, and Gill et al.'s build construct [3]. Note that we allow both universal and existential quantifiers in the type of datatype components; this avoids the need to treat constructors with existentially... |

95 | Putting type annotations to work
- Odersky, Laufer
- 1996
(Show Context)
Citation Context ...nsion of ML with both universally and existentially quantified datatype components to model aspects of object-oriented languages, but did not discuss type inference. Recent work by Odersky and Laufer =-=[22]-=- has similar goals to the present paper and permits universal quantification of datatype fields, with an encoding to simulate existential quantification. However, their approach requires a significant... |

63 |
editors. Report on the Programming Language Haskell 98. A non-strict Purely Functional Language
- Jones, Hughes
- 1999
(Show Context)
Citation Context ...er 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 [20] and Haskell =-=[8]-=-, new types To appear in the Twenty Fourth Annual ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, Paris, France, January 15-17, 1997. Copyright c fl 1997 by the Association for Com... |

61 | Polymorphic type inference and abstract data types
- Läufer, Odersky
- 1994
(Show Context)
Citation Context ...mer provides support for first-class polymorphism, while the latter can be used to deal with examples of first-class abstract datatypes [21] in the style suggested by Perry [23] and refined by Laufer =-=[14, 16]-=-. The main subjects covered in the remaining sections of this paper are as follows: ffl Section 2 shows how ideas from logic can be used to develop a type system that allows datatypes with components ... |

54 |
Programming Objects with ML-ART: An extension to ML with Abstract and Record Types
- Rémy
- 1994
(Show Context)
Citation Context ...ified component types. For example, Perry [23] and Laufer [14] have each described extensions of Milner's type inference algorithm that allow datatypes with existentially quantified components. R'emy =-=[28]-=- used an extension of ML with both universally and existentially quantified datatype components to model aspects of object-oriented languages, but did not discuss type inference. Recent work by Odersk... |

53 | The implementation of the Gofer functional programming system
- Jones
- 1994
(Show Context)
Citation Context ...plementors of Haskell side-stepped the problems of augmenting the language with general FCP-like constructs by choosing either a more powerful language like System F [5], or a simple untyped language =-=[10]-=- as a target for the translation of source programs. The introduction of constructor classes [11] lead to the discovery of several new uses for overloading. Some of the best known applications---for e... |

53 |
The essence of functional programming (invited talk
- Wadler
- 1992
(Show Context)
Citation Context ... FCP, a mnemonic for First-Class Polymorphism. ffl Section 3 illustrates the expressiveness of FCP. Our examples include a representation for booleans and Church numerals, a facility for using monads =-=[32]-=- as first-class values, a treatment of stacks as abstract datatypes, and the Pierce-Turner representation of objects using existential types [27]. These examples have been tested using a prototype imp... |

48 |
Parametric overloading in polymorphic programming languages
- Kaes
- 1988
(Show Context)
Citation Context ...askell + FCP r \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma \Gamma Figure 12: Extensions of Hindley-Milner typing Type class overloading, in the form described by Kaes =-=[13]-=-, and Wadler and Blott [33], was probably the first of these three extensions to be incorporated in a widely used programming language. The semantics of the system of type classes in the paper by Wadl... |

29 | Type classes with existential types
- Läufer
- 2005
(Show Context)
Citation Context ...omponents whose types are qualified by class constraints. To the best of our knowledge, only the special case of datatypes with existentially quantified components has been considered in work to date =-=[15]-=-. Type inference can be thought of as a compromise between the convenience of programming without type annotations and the expressiveness of explicitly-typed languages. Practical systems include eleme... |

27 | On the undecidability of partial polymorphic type reconstruction. Fundarnenta Informaticae
- Pfenning
- 1993
(Show Context)
Citation Context ...andard presentation of System F requires explicit type annotations for every -bound variable, and the type inference problems for implicitly and partially typed variations of System F are undecidable =-=[34, 1, 26]-=-. Our approach is inspired by rules from predicate calculus that are used to convert logical formulae to prenex form, with all quantifiers at the outermost level. This leads to a system that allows bo... |

26 |
The Implementation of Practical Functional Programming Languages
- Perry
- 1990
(Show Context)
Citation Context ...atatype components. The former provides support for first-class polymorphism, while the latter can be used to deal with examples of first-class abstract datatypes [21] in the style suggested by Perry =-=[23]-=- and refined by Laufer [14, 16]. The main subjects covered in the remaining sections of this paper are as follows: ffl Section 2 shows how ideas from logic can be used to develop a type system that al... |

25 |
Typability and Type Checking in the Second-Order - Calculus Are Equivalent and Undecidable. submitted to APAP
- Wells
- 1996
(Show Context)
Citation Context ...andard presentation of System F requires explicit type annotations for every -bound variable, and the type inference problems for implicitly and partially typed variations of System F are undecidable =-=[34, 1, 26]-=-. Our approach is inspired by rules from predicate calculus that are used to convert logical formulae to prenex form, with all quantifiers at the outermost level. This leads to a system that allows bo... |

22 | Typability and type-checking in the second-order λ-calculus are equivalent and undecidable - Wells - 1994 |

21 |
Partial polymorphic type inference is undecidable
- Boehm
- 1985
(Show Context)
Citation Context ...andard presentation of System F requires explicit type annotations for every -bound variable, and the type inference problems for implicitly and partially typed variations of System F are undecidable =-=[34, 1, 26]-=-. Our approach is inspired by rules from predicate calculus that are used to convert logical formulae to prenex form, with all quantifiers at the outermost level. This leads to a system that allows bo... |

20 |
Building interpreters by composing monads
- Jr
- 1994
(Show Context)
Citation Context ...source translation. The ability to reify monads as first-class data structures was also an important part of Steele's work to construct programming language interpreters from reusable building blocks =-=[31]-=-. These ideas can be expressed very neatly in FCP, using essentially the same definitions as in Figure 4. By comparison, Steele found that he had to use a program specializer to circumvent problems ca... |

11 |
editors, Report on the programming language Haskell, a non-strict purely-functional programming language, Version 1.3
- Peterson, Hammond
- 1996
(Show Context)
Citation Context ... serve both to illustrate the expressiveness of the system, and to show the notation that is used in our prototype implementation, which is an extension of the Hugs [12] implementation of Haskell 1.3 =-=[24]-=-. The first example is an implementation for booleans using polymorphism and functions. Apart from passing them around as normal first-class entities, the only way that boolean values can be used is t... |

9 |
The Glasgow Haskell Compiler: A retrospective
- Hall, Hammond, et al.
- 1992
(Show Context)
Citation Context ...) = Stack (push' x self) push' pop top empty top :: Stack a -? a top (Stack self push pop top' empty) = top' self testExpr :: [Int] testExpr = map (top . push 1) [makeListStack [1,2,3], makeListStack =-=[4,5]-=-] Figure 5: A simple encoding of stack packages tion, hidden by an existential quantifier. Note that our prototype implementation adopts the convention that variables beginning with an x are existenti... |

3 | On the expressive power of constructor classes
- Duponcheel, Meijer
- 1994
(Show Context)
Citation Context ...tation, to provide a typesafe representation for monads [32] as first-class values. Much has been achieved using constructor class overloading [11] to explore the use of monads and monad transformers =-=[2, 18]-=-. As this example suggests, the same experiments can be repeated in FCP by packaging these items up as first-class values. In fact, FCP has exactly the features needed to describe the implementation o... |

2 |
Hugs 1.3 user manual
- Jones
- 1996
(Show Context)
Citation Context ..., we pause for some examples. These serve both to illustrate the expressiveness of the system, and to show the notation that is used in our prototype implementation, which is an extension of the Hugs =-=[12]-=- implementation of Haskell 1.3 [24]. The first example is an implementation for booleans using polymorphism and functions. Apart from passing them around as normal first-class entities, the only way t... |