• Documents
  • Authors
  • Tables
  • Log in
  • Sign up
  • MetaCart
  • DMCA
  • Donate

CiteSeerX logo

Advanced Search Include Citations
Advanced Search Include Citations | Disambiguate

First-class Polymorphism with Type Inference (0)

by Mark P. Jones
Add To MetaCart

Tools

Sorted by:
Results 1 - 10 of 53
Next 10 →

Typed Combinators for Generic Traversal

by Ralf Lämmel, Joost Visser - Proc. of PADL 2002 , 2002
"... Lacking support for generic traversal, functional programming languages suffer from a scalability problem when applied to largescale program transformation problems. As a solution, we introduce functional strategies: typeful generic functions that not only can be applied to terms of any type, bu ..."
Abstract - Cited by 72 (23 self) - Add to MetaCart
Lacking support for generic traversal, functional programming languages suffer from a scalability problem when applied to largescale program transformation problems. As a solution, we introduce functional strategies: typeful generic functions that not only can be applied to terms of any type, but which also allow generic traversal into subterms.

Encoding types in ML-like languages

by Zhe Yang , 1998
"... A Hindley-Milner type system such as ML's seems to prohibit type-indexed values, i.e., functions that map a family of types to a family of values. Such functions generally perform case analysis on the input types and return values of possibly different types. The goal of our work is to demonstr ..."
Abstract - Cited by 45 (0 self) - Add to MetaCart
A Hindley-Milner type system such as ML's seems to prohibit type-indexed values, i.e., functions that map a family of types to a family of values. Such functions generally perform case analysis on the input types and return values of possibly different types. The goal of our work is to demonstrate how to program with type-indexed values within a Hindley-Milner type system. Our first approach is to interpret an input type as its corresponding value, recursively. This solution is type-safe, in the sense that the ML type system statically prevents any mismatch between the input type and function arguments that depend on this type. Such specific type interpretations, however, prevent us from combining different type-indexed values that share the same type. To meet this objection, we focus on finding a value-independent type encoding that can be shared by different functions. We propose and compare two solutions. One requires first-class and higher-order polymorphism, and, thus, is not implementable in the core language of ML, but it can be programmed using higher-order functors in Standard ML of New Jersey. Its usage, however, is clumsy. The other approach uses embedding/projection functions. It appears to be more practical. We demonstrate the usefulness of type-indexed values through examples including type-directed partial evaluation, C printf-like formatting, and subtype coercions. Finally, we discuss the tradeoffs between our approach and some other solutions based on more expressive typing disciplines.
(Show Context)

Citation Context

...tial work has been done in this direction, such as allowing selective annotations of -bound variables with polymorphic types [23] or packaging of these variables using polymorphic datatype components =-=[16]-=-. Moreover, higher-order polymorphism [15] is needed to allow parameterizing over a type constructor, e.g., the type constructor obj. In fact, such type encodings are similar to a Martin-Lofstyle enco...

HMF: Simple type inference for first-class polymorphism

by Daan Leijen , 2008
"... HMF is a conservative extension of Hindley-Milner type inference with first-class polymorphism. In contrast to other proposals, HML uses regular System F types and has a simple type inference algorithm that is just a small extension of the usual Damas-Milner algorithm W. Given the relative simplicit ..."
Abstract - Cited by 23 (1 self) - Add to MetaCart
HMF is a conservative extension of Hindley-Milner type inference with first-class polymorphism. In contrast to other proposals, HML uses regular System F types and has a simple type inference algorithm that is just a small extension of the usual Damas-Milner algorithm W. Given the relative simplicity and expressive power, we feel that HMF can be an attractive type system in practice. There is a reference implementation of the type system available online together with
(Show Context)

Citation Context

...he completeness of Milner’s algorithm, extending the type inference system with polymorphic references [25]. Wells [1] shows that general type inference for unannotated System F is undecidable. Jones =-=[7]-=- extends Hindley-Milner with first class polymorphism by wrapping polymorphic values into type constructors. This is a simple and effective technique that is widely used in Haskell but one needs to de...

A Framework for Extended Algebraic Data Types

by Martin Sulzmann, et al. , 2005
"... Extended forms of algebraic data types allow for sophisticated type extensions. A number of proposals exists and its often hard to understand what has been achieved. Here, we present a unifying framework which subsumes previous systems such as guarded recursive data types, the combination of type cl ..."
Abstract - Cited by 19 (8 self) - Add to MetaCart
Extended forms of algebraic data types allow for sophisticated type extensions. A number of proposals exists and its often hard to understand what has been achieved. Here, we present a unifying framework which subsumes previous systems such as guarded recursive data types, the combination of type classes and existential types etc. We give an in depth discussion of the type inference problem and identify sufficient conditions under which we obtain completeness. Our results show that our system is practical and greatly extends the expressive power of languages such as Haskell and ML.

A Recursive do for Haskell

by Levent Erkök, John Launchbury , 2002
"... Certain programs making use of monads need to perform recursion over the values of monadic actions. Although the do-notation of Haskell provides a convenient framework for monadic programming, it lacks the generality to support such recursive bindings. In this paper, we describe an enhanced translat ..."
Abstract - Cited by 17 (1 self) - Add to MetaCart
Certain programs making use of monads need to perform recursion over the values of monadic actions. Although the do-notation of Haskell provides a convenient framework for monadic programming, it lacks the generality to support such recursive bindings. In this paper, we describe an enhanced translation schema for the donotation and its integration into Haskell. The new translation allows variables to be bound recursively, provided the underlying monad comes equipped with an appropriate fixed-point operator.

Monatron: an extensible monad transformer library. Available at http://www.cs.nott.ac.uk/~mjj/pubs/monatron.pdf

by Mauro Jaskelioff
"... Abstract. Monads are pervasive in functional programming. In order to reap the benefits of their abstraction power, combinator libraries for monads are necessary. Monad transformers provide the basis for such libraries, and are based on a design that has proved to be successful. In this article, we ..."
Abstract - Cited by 17 (2 self) - Add to MetaCart
Abstract. Monads are pervasive in functional programming. In order to reap the benefits of their abstraction power, combinator libraries for monads are necessary. Monad transformers provide the basis for such libraries, and are based on a design that has proved to be successful. In this article, we show that this design has a number of shortcomings and provide a new design that builds on the strengths of the traditional design, but addresses its problems. 1
(Show Context)

Citation Context

...one implementation of an operation for a given monad. Portability: A fully-functional implementation only requires to extend Haskell with rank-2 types, a fairly standard and well-understood extension =-=[10]-=-. However, if one wants operation overloading then all the extensions that were required in the traditional design will be necessary (see Section 4.1). The main difference between the traditional appr...

The sketch of a polymorphic symphony

by Ralf Lämmel , 2002
"... Functional strategies were previously defined as first-class generic functions which can traverse into terms while mixing uniform and type-specific behaviour. The first-class status is witnessed by a combinator style of generic programming. This symphony reconstructs functional strategies as an amal ..."
Abstract - Cited by 17 (9 self) - Add to MetaCart
Functional strategies were previously defined as first-class generic functions which can traverse into terms while mixing uniform and type-specific behaviour. The first-class status is witnessed by a combinator style of generic programming. This symphony reconstructs functional strategies as an amalgamation of certain bits of parametric polymorphism, type case, polytypism, and overloading. We illustrate the expressiveness and conciseness of this reconstruction by providing highly parameterized definitions of traversal schemes. The resulting style of generic programming is extremely lightweight and easy to use because it only involves two special combinators not yet present in standard functional programming. The reconstruction is geared towards Haskell, and it is supported by a generative tool YAGH—Yet Another Generic Haskell.

Flexible types: robust type inference for first-class polymorphism

by Daan Leijen - In Proceedings of the 36th ACM Symposium on Principles of Programming Languages (POPL’09 , 2009
"... We present HML, a type inference system that supports full firstclass polymorphism where few annotations are needed: only function parameters with a polymorphic type need to be annotated. HML is a simplification of MLF where only flexibly quantified types are used. This makes the types easier to wor ..."
Abstract - Cited by 14 (1 self) - Add to MetaCart
We present HML, a type inference system that supports full firstclass polymorphism where few annotations are needed: only function parameters with a polymorphic type need to be annotated. HML is a simplification of MLF where only flexibly quantified types are used. This makes the types easier to work with from a programmers perspective, and simplifies the implementation of the type inference algorithm. Still, HML retains much of the expressiveness of MLF, it is robust with respect to small program transformations, and has a simple specification of the type rules with an effective type inference algorithm that infers principal types. A small reference implementation with many examples is
(Show Context)

Citation Context

...annotations to make programming with first-class polymorphism practical. There is a long list of research papers that propose type inference systems for System F (Peyton Jones et al. 2007; Rémy 2005; =-=Jones 1997-=-; Le Botlan and Rémy 2003; Le Botlan 2004; Odersky and Läufer 1996; Garrigue and Rémy 1999; Vytiniotis et al. 2006; Dijkstra 2005; Leijen 2008a). All of these systems mostly differ in where type annot...

Prolog's Control Constructs in a Functional . . .

by Ralf Hinze - INTERNATIONAL JOURNAL OF FOUNDATIONS OF COMPUTER SCIENCE
"... The purpose of this article is twofold. First, we show that Prolog's control constructs can be smoothly integrated into a functional language like Haskell. The resulting `language', termed embedded Prolog, incorporates many of the features prescribed by the Prolog ISO standard: control ..."
Abstract - Cited by 13 (6 self) - Add to MetaCart
The purpose of this article is twofold. First, we show that Prolog's control constructs can be smoothly integrated into a functional language like Haskell. The resulting `language', termed embedded Prolog, incorporates many of the features prescribed by the Prolog ISO standard: control constructs including the cut, all solution collecting functions, and error handling facilities. Embedded Prolog lacks some concepts such as logical variables but it inherits all of Haskell's strengths, eg static polymorphic typing, higher order functions etc. Technically, the integration is achieved using monads and monad transformers. One of the main innovations is the de nition of a backtracking monad transformer, which allows us to combine backtracking with exception handling and interaction. Second, we work towards an axiomatization of the operations, through which the computational features are accessed. Equations are used to lay down the meaning of the various operations and their interrelations enabling the programmer to reason about programs in a simple calculational style. The axiomatization is applied to show that each nite computation has a simple canonical form.

Pragmatic Subtyping in Polymorphic Languages

by Johan Nordlander - In Proceedings of the third ACM SIGPLAN International Conference on Functional Programming (ICFP'98 , 1997
"... We present a subtyping extension to the Hindley/Milner type system that is based on name inequivalence. This approach allows the subtype relation to be defined by incremental construction of polymorphic records and datatypes, in a way that subsumes the basic type systems of both languages like ML an ..."
Abstract - Cited by 13 (2 self) - Add to MetaCart
We present a subtyping extension to the Hindley/Milner type system that is based on name inequivalence. This approach allows the subtype relation to be defined by incremental construction of polymorphic records and datatypes, in a way that subsumes the basic type systems of both languages like ML and Java. As the main contribution of the paper, we describe a partial type inference algorithm for the extended system which favours succinctness over generality, in the sense that it never infers types with subtype constraints. The algorithm is based on an efficient approximating constraint solver, and is able to type a wide range of programs that utilize subtyping and polymorphism in a non-trivial way. Since constrained types are not inferred, the algorithm cannot be complete; however, we provide a completeness result w. r. t. the Hindley/Milner type system as a form of characterizing lower bound. 1 Introduction The combination of subtyping with polymorphic type inference has been under i...
Powered by: Apache Solr
  • About CiteSeerX
  • Submit and Index Documents
  • Privacy Policy
  • Help
  • Data
  • Source
  • Contact Us

Developed at and hosted by The College of Information Sciences and Technology

© 2007-2019 The Pennsylvania State University