Results 1 
6 of
6
Polytypic Values Possess Polykinded Types
, 2000
"... A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the socalled kind system, which distinguishes between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to ..."
Abstract

Cited by 106 (20 self)
 Add to MetaCart
A polytypic value is one that is defined by induction on the structure of types. In Haskell the type structure is described by the socalled kind system, which distinguishes between manifest types like the type of integers and functions on types like the list type constructor. Previous approaches to polytypic programming were restricted in that they only allowed to parameterize values by types of one fixed kind. In this paper we show how to define values that are indexed by types of arbitrary kinds. It appears that these polytypic values possess types that are indexed by kinds. We present several examples that demonstrate that the additional exibility is useful in practice. One paradigmatic example is the mapping function, which describes the functorial action on arrows. A single polytypic definition yields mapping functions for datatypes of arbitrary kinds including first and higherorder functors. Polytypic values enjoy polytypic properties. Using kindindexed logical relations we prove...
Generalizing Generalized Tries
, 1999
"... A trie is a search tree scheme that employs the structure of search keys to organize information. Tries were originally devised as a means to represent a collection of records indexed by strings over a fixed alphabet. Based on work by C.P. Wadsworth and others, R.H. Connelly and F.L. Morris generali ..."
Abstract

Cited by 31 (8 self)
 Add to MetaCart
A trie is a search tree scheme that employs the structure of search keys to organize information. Tries were originally devised as a means to represent a collection of records indexed by strings over a fixed alphabet. Based on work by C.P. Wadsworth and others, R.H. Connelly and F.L. Morris generalized the concept to permit indexing by elements of an arbitrary monomorphic datatype. Here we go one step further and define tries and operations on tries generically for arbitrary firstorder polymorphic datatypes. The derivation is based on techniques recently developed in the context of polytypic programming. It is well known that for the implementation of generalized tries nested datatypes and polymorphic recursion are needed. Implementing tries for polymorphic datatypes places even greater demands on the type system: it requires rank2 type signatures and higherorder polymorphic nested datatypes. Despite these requirements the definition of generalized tries for polymorphic datatypes is...
Efficient Generalized Folds
, 1999
"... Fold operators capture a common recursion pattern over algebraic datatypes. A fold essentially replaces constructors by functions. However, if the datatype is parameterized, the corresponding fold operates on polymorphic functions which severely limits its applicability. In order to overcome this li ..."
Abstract

Cited by 11 (0 self)
 Add to MetaCart
Fold operators capture a common recursion pattern over algebraic datatypes. A fold essentially replaces constructors by functions. However, if the datatype is parameterized, the corresponding fold operates on polymorphic functions which severely limits its applicability. In order to overcome this limitation R. Bird and R. Paterson (Bird & Paterson, 1999b) have proposed socalled generalized folds. We show how to define a variation of these folds by induction on the structure of datatype definitions. Unfortunately, for some datatypes generalized folds are less efficient than one would expect. We identify the source of inefficiency and explain how to remedy this shortcoming. While conceptually simple, our approach places high demands on the type system: it requires polymorphic recursion, rank2 types, and a strong form of type constructor polymorphism. 1 Introduction Fold operators are in every functional programmer's toolbox. In essence, a fold operator replaces constructors by functi...
Dimension Inference under Polymorphic Recursion
 In Proc. 7th Conf. Functional Programming Languages and Computer Architecture
, 1995
"... Numeric types can be given polymorphic dimension parameters, in order to avoid dimension errors and unit errors. The most general dimensions can be inferred automatically. It has been observed that polymorphic recursion is more important for the dimensions than for the proper types. We show that, un ..."
Abstract

Cited by 9 (1 self)
 Add to MetaCart
Numeric types can be given polymorphic dimension parameters, in order to avoid dimension errors and unit errors. The most general dimensions can be inferred automatically. It has been observed that polymorphic recursion is more important for the dimensions than for the proper types. We show that, under polymorphic recursion, type inference amounts to syntactic semiunification of proper types, followed by equational semiunification of dimensions. Syntactic semiunification is unfortunately undecidable, although there are procedures that work well in practice, and proper types given by the programmer can be checked. However, the dimensions form a vector space (provided that their exponents are rational numbers). We give a polynomialtime algorithm that decides if a semiunification problem in a vector space can be solved and, if so, returns a most general semiunifier. 1 Introduction We will combine three good things as far as possible: dimension types, polymorphic recursion, and aut...
Numerical Representations as HigherOrder Nested Datatypes
, 1998
"... Number systems serve admirably as templates for container types: a container object of size n is modelled after the representation of the number n and operations on container objects are modelled after their numbertheoretic counterparts. Binomial queues are probably the first data structure that wa ..."
Abstract

Cited by 5 (2 self)
 Add to MetaCart
Number systems serve admirably as templates for container types: a container object of size n is modelled after the representation of the number n and operations on container objects are modelled after their numbertheoretic counterparts. Binomial queues are probably the first data structure that was designed with this analogy in mind. In this paper we show how to express these socalled numerical representations as higherorder nested datatypes. A nested datatype allows to capture the structural invariants of a numerical representation, so that the violation of an invariant can be detected at compiletime. We develop a programming method which allows to adapt algorithms to the new representation in a mostly straightforward manner. The framework is employed to implement three different container types: binary randomaccess lists, binomial queues, and 23 finger search trees. The latter data structure, which is treated in some depth, can be seen as the main innovation from a datastruct...
Perfect Trees and Bitreversal Permutations
, 1999
"... A famous algorithm is the Fast Fourier Transform, or FFT. An efficient iterative version of the FFT algorithm performs as a first step a bitreversal permutation of the input list. The bitreversal permutation swaps elements whose indices have binary representations that are the reverse of each othe ..."
Abstract

Cited by 4 (2 self)
 Add to MetaCart
A famous algorithm is the Fast Fourier Transform, or FFT. An efficient iterative version of the FFT algorithm performs as a first step a bitreversal permutation of the input list. The bitreversal permutation swaps elements whose indices have binary representations that are the reverse of each other. Using an amortized approach this operation can be made to run in linear time on a randomaccess machine. An intriguing question is whether a lineartime implementation is also feasible on a pointer machine, that is in a purely functional setting. We show that the answer to this question is in the affirmative. In deriving a solution we employ several advanced programming language concepts such as nested datatypes, associated fold and unfold operators, rank2 types, and polymorphic recursion. 1 Introduction A bitreversal permutation operates on lists whose length is n = 2 k for some natural number k and swaps elements whose indices have binary representations that are the reverse of eac...