Results 1  10
of
11
Firstclass phantom types
, 2003
"... Classical phantom types are datatypes in which type constraints are expressed using type variables that do not appear in the datatype cases themselves. They can be used to embed typed languages into Haskell or ML. However, while such encodings guarantee that only wellformed data can be constructed, ..."
Abstract

Cited by 110 (2 self)
 Add to MetaCart
Classical phantom types are datatypes in which type constraints are expressed using type variables that do not appear in the datatype cases themselves. They can be used to embed typed languages into Haskell or ML. However, while such encodings guarantee that only wellformed data can be constructed, they do not permit typesafe deconstruction without additional tagging and runtime checks. We introduce firstclass phantom types, which make such constraints explicit via type equations. Examples of firstclass phantom types include typed type representations and typed higherorder abstract syntax trees. These types can be used to support typed generic functions, dynamic typing, and staged compilation in higherorder, statically typed languages such as Haskell or Standard ML. In our system, type constraints can be equations between type constructors as well as type functions of higherorder kinds. We prove type soundness and decidability for a Haskelllike language extended by firstclass phantom types. 1
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 108 (19 self)
 Add to MetaCart
(Show Context)
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...
TypeBased Flow Analysis: From Polymorphic Subtyping to CFLReachability.
 In Proceedings of the 28th Annual ACM SIGPLANSIGACT Symposium on Principles of Programming Languages
, 2001
"... We present a novel approach to scalable implementation of typebased flow analysis with polymorphic subtyping. Using a new presentation of polymorphic subtyping with instantiation constraints, we are able to apply contextfree language (CFL) reachability techniques to typebased flow analysis. We de ..."
Abstract

Cited by 68 (1 self)
 Add to MetaCart
We present a novel approach to scalable implementation of typebased flow analysis with polymorphic subtyping. Using a new presentation of polymorphic subtyping with instantiation constraints, we are able to apply contextfree language (CFL) reachability techniques to typebased flow analysis. We develop a CFLbased algorithm for computing flow information in time O(n 3 ), where n is the size of the typed program. The algorithm substantially improves upon the best previously known algorithm for flow analysis based on polymorphic subtyping with complexity O(n 8 ). Our technique also yields the first demanddriven algorithm for polymorphic subtypebased flowcomputation. It works directly on higherorder programs with structured data of finite type (unbounded data structures are incorporated via finite approximations), supports contextsensitive, global flow summarization and includes polymorphic recursion.
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 35 (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...
Memo Functions, Polytypically!
 Proceedings of the 2nd Workshop on Generic Programming, Ponte de
, 2000
"... . This paper presents a polytypic implementation of memo functions that are based on digital search trees. A memo function can be seen as the composition of a tabulation function that creates a memo table and a lookup function that queries the table. We show that tabulation can be derived from ..."
Abstract

Cited by 14 (5 self)
 Add to MetaCart
(Show Context)
. This paper presents a polytypic implementation of memo functions that are based on digital search trees. A memo function can be seen as the composition of a tabulation function that creates a memo table and a lookup function that queries the table. We show that tabulation can be derived from lookup by inverse function construction. The type of memo tables is dened by induction on the structure of argument types and is parametric with respect to the result type of memo functions. A memo table for a xed argument type is then a functor and lookup and tabulation are natural isomorphisms. We provide simple polytypic proofs of these properties. 1 Introduction A memo function [11] is like an ordinary function except that it caches previously computed values. If it is applied a second time to a particular argument, it immediately returns the cached result, rather than recomputing it. For storing arguments and results a memo function internally employs an index structure, the ...
Program Optimisation, Naturally
"... this paper we derive another, quite di#erent, lineartime algorithm for reversing a list. The derivation relies on a higherorder naturality [5] property of the function unzip, the function that turns a list of pairs into a pair of lists in the obvious way. The final program uses ..."
Abstract

Cited by 9 (3 self)
 Add to MetaCart
(Show Context)
this paper we derive another, quite di#erent, lineartime algorithm for reversing a list. The derivation relies on a higherorder naturality [5] property of the function unzip, the function that turns a list of pairs into a pair of lists in the obvious way. The final program uses
Programming Examples Needing Polymorphic Recursion
 IN IN PROCEEDINGS 3RD INTERNATIONAL WORKSHOP INTERSECTION TYPES AND RELATED SYSTEMS (ITRS 2004
, 2004
"... Inferring types for polymorphic recursive function definitions (abbreviated to polymorphic recursion) is a recurring topic on the mailing lists of popular typed programming languages. This is despite the fact that type inference for polymorphic recursion using 8types has been proved undecidable. Th ..."
Abstract

Cited by 6 (0 self)
 Add to MetaCart
Inferring types for polymorphic recursive function definitions (abbreviated to polymorphic recursion) is a recurring topic on the mailing lists of popular typed programming languages. This is despite the fact that type inference for polymorphic recursion using 8types has been proved undecidable. This report presents several programming examples involving polymorphic recursion and determines their typability under various type systems, including the HindleyMilner system, an intersectiontype system, and extensions of these two. The goal of this report is to show that many of these examples are typable using a system of intersection types as an alternative form of polymorphism. By accomplishing this, we hope to lay the foundation for future research into a decidable intersectiontype inference algorithm. We do not
From Polymorphic Subtyping to CFL Reachability: ContextSensitive Flow Analysis Using Instantiation Constraints
, 1999
"... We present a novel approach to computing contextsensitive flow of values through procedures and data structures. Our approach combines and extends techniques from two seemingly disparate areas: polymorphic subtyping and interprocedural dataflow analysis based on contextfree language reachability. ..."
Abstract

Cited by 5 (2 self)
 Add to MetaCart
We present a novel approach to computing contextsensitive flow of values through procedures and data structures. Our approach combines and extends techniques from two seemingly disparate areas: polymorphic subtyping and interprocedural dataflow analysis based on contextfree language reachability. The resulting technique offers several advantages over previous approaches: it works directly on higherorder programs, provides demanddriven interprocedural queries, and improves the asymptotic complexity of a known algorithm based on polymorphic subtyping from O(n^8) to O(n&sup3;) for computing all queries. For intraprocedural flow restricted to equivalence classes, our algorithm yields linear interprocedural ow queries.
Incremental Polymorphic Type Checking With Update
, 1992
"... We describe a variant of Milner's ML type inference algorithm which can be used to perform incremental type checking of programs with partially unspecied functions (or predicates in Prolog). This supports modication (e.g. for correction) of procedures dened previously and provides for a conveni ..."
Abstract

Cited by 2 (0 self)
 Add to MetaCart
We describe a variant of Milner's ML type inference algorithm which can be used to perform incremental type checking of programs with partially unspecied functions (or predicates in Prolog). This supports modication (e.g. for correction) of procedures dened previously and provides for a convenient treatment of toplevel mutual recursion including Prologstyle incremental clausal denition. The system allows us to: dene a function of, say, type ! , use it in suceeding functions and then modify its denition to a type instance, such as list( int) ! list( int), provided that, in the meantime, it has not been used by other functions at an incompatible instance. Undened procedures can be treated as having type (or ! corresponding to the function x:fail ). This is useful for the case of languages (like HOPE, Miranda, Haskell and Prolog) which require that all toplevel procedures are dened mutually recursively  forward references can then be treated as if dened by x...