Results 1  10
of
52
Typed Combinators for Generic Traversal
 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 70 (22 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 MLlike languages
, 1998
"... A HindleyMilner type system such as ML's seems to prohibit typeindexed 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 47 (0 self)
 Add to MetaCart
(Show Context)
A HindleyMilner type system such as ML's seems to prohibit typeindexed 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 typeindexed values within a HindleyMilner type system. Our first approach is to interpret an input type as its corresponding value, recursively. This solution is typesafe, 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 typeindexed values that share the same type. To meet this objection, we focus on finding a valueindependent type encoding that can be shared by different functions. We propose and compare two solutions. One requires firstclass and higherorder polymorphism, and, thus, is not implementable in the core language of ML, but it can be programmed using higherorder 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 typeindexed values through examples including typedirected partial evaluation, C printflike formatting, and subtype coercions. Finally, we discuss the tradeoffs between our approach and some other solutions based on more expressive typing disciplines.
HMF: Simple type inference for firstclass polymorphism
, 2008
"... HMF is a conservative extension of HindleyMilner type inference with firstclass 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 DamasMilner algorithm W. Given the relative simplicit ..."
Abstract

Cited by 23 (1 self)
 Add to MetaCart
(Show Context)
HMF is a conservative extension of HindleyMilner type inference with firstclass 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 DamasMilner 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
Monatron: an extensible monad transformer library. Available at http://www.cs.nott.ac.uk/~mjj/pubs/monatron.pdf
"... 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
(Show Context)
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
A Recursive do for Haskell
, 2002
"... Certain programs making use of monads need to perform recursion over the values of monadic actions. Although the donotation 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 donotation 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 fixedpoint operator.
The sketch of a polymorphic symphony
, 2002
"... Functional strategies were previously defined as firstclass generic functions which can traverse into terms while mixing uniform and typespecific behaviour. The firstclass 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 firstclass generic functions which can traverse into terms while mixing uniform and typespecific behaviour. The firstclass 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.
Pragmatic Subtyping in Polymorphic Languages
 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 14 (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 nontrivial 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...
Flexible types: robust type inference for firstclass polymorphism
 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
(Show Context)
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
Prolog's Control Constructs in a Functional . . .
 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.
Programming With Types
 CORNELL UNIVERSITY
, 2002
"... Runtime type analysis is an increasingly important linguistic mechanism in modern programming languages. Language runtime systems use it to implement services such as accurate garbage collection, serialization, cloning and structural equality. Component frameworks rely on it to provide reflection m ..."
Abstract

Cited by 13 (2 self)
 Add to MetaCart
Runtime type analysis is an increasingly important linguistic mechanism in modern programming languages. Language runtime systems use it to implement services such as accurate garbage collection, serialization, cloning and structural equality. Component frameworks rely on it to provide reflection mechanisms so they may discover and interact with program interfaces dynamically. Runtime type analysis is also crucial for large, distributed systems that must be dynamically extended, because it allows those systems to check program invariants when new code and new forms of data are added. Finally, many generic userlevel algorithms for iteration, pattern matching, and unification can be defined through type analysis mechanisms. However, existing frameworks for runtime type analysis were designed for simple type systems. They do not scale well to the sophisticated type systems of modern and nextgeneration programming languages that include complex constructs such as firstclass abstract types, recursive types, objects, and type parameterization. In addition, facilities to support type analysis often require complicated