Results 1  10
of
79
Simple unificationbased type inference for GADTs
, 2006
"... Generalized algebraic data types (GADTs), sometimes known as “guarded recursive data types ” or “firstclass phantom types”, are a simple but powerful generalization of the data types of Haskell and ML. Recent works have given compelling examples of the utility of GADTs, although type inference is k ..."
Abstract

Cited by 159 (35 self)
 Add to MetaCart
Generalized algebraic data types (GADTs), sometimes known as “guarded recursive data types ” or “firstclass phantom types”, are a simple but powerful generalization of the data types of Haskell and ML. Recent works have given compelling examples of the utility of GADTs, although type inference is known to be difficult. Our contribution is to show how to exploit programmersupplied type annotations to make the type inference task almost embarrassingly easy. Our main technical innovation is wobbly types, which express in a declarative way the uncertainty caused by the incremental nature of typical typeinference algorithms.
System F with type equality coercions
, 2007
"... We introduce System FC, which extends System F with support for nonsyntactic type equality. There are two main extensions: (i) explicit witnesses for type equalities, and (ii) open, nonparametric type functions, given meaning by toplevel equality axioms. Unlike System F, FC is expressive enough to ..."
Abstract

Cited by 75 (25 self)
 Add to MetaCart
We introduce System FC, which extends System F with support for nonsyntactic type equality. There are two main extensions: (i) explicit witnesses for type equalities, and (ii) open, nonparametric type functions, given meaning by toplevel equality axioms. Unlike System F, FC is expressive enough to serve as a target for several different sourcelanguage features, including Haskell’s newtype, generalised algebraic data types, associated types, functional dependencies, and perhaps more besides.
Wobbly types: type inference for generalised algebraic data types
, 2004
"... Generalised algebraic data types (GADTs), sometimes known as “guarded recursive data types ” or “firstclass phantom types”, are a simple but powerful generalisation of the data types of Haskell and ML. Recent works have given compelling examples of the utility of GADTs, although type inference is k ..."
Abstract

Cited by 48 (2 self)
 Add to MetaCart
Generalised algebraic data types (GADTs), sometimes known as “guarded recursive data types ” or “firstclass phantom types”, are a simple but powerful generalisation of the data types of Haskell and ML. Recent works have given compelling examples of the utility of GADTs, although type inference is known to be difficult. It is time to pluck the fruit. Can GADTs be added to Haskell, without losing type inference, or requiring unacceptably heavy type annotations? Can this be done without completely rewriting the alreadycomplex Haskell typeinference engine, and without complex interactions with (say) type classes? We answer these questions in the affirmative, giving a type system that explains just what type annotations are required, and a prototype implementation that implements it. Our main technical innovation is wobbly types, which express in a declarative way the uncertainty caused by the incremental nature of typical typeinference algorithms. 1
Scrap your boilerplate” reloaded
, 2006
"... Abstract. The paper “Scrap your boilerplate ” (SYB) introduces a combinator library for generic programming that offers generic traversals and queries. Classically, support for generic programming consists of two essential ingredients: a way to write (type)overloaded functions, and independently, a ..."
Abstract

Cited by 41 (11 self)
 Add to MetaCart
Abstract. The paper “Scrap your boilerplate ” (SYB) introduces a combinator library for generic programming that offers generic traversals and queries. Classically, support for generic programming consists of two essential ingredients: a way to write (type)overloaded functions, and independently, a way to access the structure of data types. SYB seems to lack the second. As a consequence, it is difficult to compare with other approaches such as PolyP or Generic Haskell. In this paper we reveal the structural view that SYB builds upon. This allows us to define the combinators as generic functions in the classical sense. We explain the SYB approach in this changed setting from ground up, and use the understanding gained to relate it to other generic programming approaches. Furthermore, we show that the SYB view is applicable to a very large class of data types, including generalized algebraic data types. 1
Applied Type System (extended abstract
 In postworkshop Proceedings of TYPES 2003
, 2004
"... Abstract. The framework Pure Type System (PTS) offers a simple and general approach to designing and formalizing type systems. However, in the presence of dependent types, there often exist some acute problems that make it difficult for PTS to accommodate many common realistic programming features s ..."
Abstract

Cited by 38 (13 self)
 Add to MetaCart
Abstract. The framework Pure Type System (PTS) offers a simple and general approach to designing and formalizing type systems. However, in the presence of dependent types, there often exist some acute problems that make it difficult for PTS to accommodate many common realistic programming features such as general recursion, recursive types, effects (e.g., exceptions, references, input/output), etc. In this paper, we propose a new framework Applied Type System (ATS) to allow for designing and formalizing type systems that can readily support common realistic programming features. The key salient feature of ATS lies in a complete separation between statics, in which types are formed and reasoned about, and dynamics, in which programs are constructed and evaluated. With this separation, it is no longer possible for a program to occur in a type as is otherwise allowed in PTS. We present not only a formal development of ATS but also mention some examples in support of using ATS as a framework to form type systems for practical programming. 1
Type Checking with Open Type Functions
"... We report on an extension of Haskell with open typelevel functions and equality constraints that unifies earlier work on GADTs, functional dependencies, and associated types. The contribution of the paper is that we identify and characterise the key technical challenge of entailment checking; and w ..."
Abstract

Cited by 37 (18 self)
 Add to MetaCart
We report on an extension of Haskell with open typelevel functions and equality constraints that unifies earlier work on GADTs, functional dependencies, and associated types. The contribution of the paper is that we identify and characterise the key technical challenge of entailment checking; and we give a novel, decidable, sound, and complete algorithm to solve it, together with some practicallyimportant variants. Our system is implemented in GHC, and is already in active use.
Practical RefinementType Checking
, 1997
"... Refinement types allow many more properties of programs to be expressed and statically checked than conventional type systems. We present a practical algorithm for refinementtype checking in a calculus enriched with refinementtype annotations. We prove that our basic algorithm is sound and comple ..."
Abstract

Cited by 34 (1 self)
 Add to MetaCart
Refinement types allow many more properties of programs to be expressed and statically checked than conventional type systems. We present a practical algorithm for refinementtype checking in a calculus enriched with refinementtype annotations. We prove that our basic algorithm is sound and complete, and show that every term which has a refinement type can be annotated as required by our algorithm. Our positive experience with an implementation of an extension of this algorithm to the full core language of Standard ML demonstrates that refinement types can be a practical program development tool in a realistic programming language. The required refinement type definitions and annotations are not much of a burden and serve as formal, machinechecked explanations of code invariants which otherwise would remain implicit. 1 Introduction The advantages of staticallytyped programming languages are well known, and have been described many times (e.g. see [Car97]). However, conventional ty...
Contracts as pairs of projections
, 2006
"... Abstract. Assertionbased contracts provide a powerful mechanism for stating invariants at module boundaries and for enforcing them uniformly. In 2002, Findler and Felleisen showed how to add contracts to higherorder functional languages, allowing programmers to assert invariants about functions as ..."
Abstract

Cited by 28 (4 self)
 Add to MetaCart
Abstract. Assertionbased contracts provide a powerful mechanism for stating invariants at module boundaries and for enforcing them uniformly. In 2002, Findler and Felleisen showed how to add contracts to higherorder functional languages, allowing programmers to assert invariants about functions as values. Following up in 2004, Blume and McAllester provided a quotient model for contracts. Roughly speaking, their model equates a contract with the set of values that cannot violate the contract. Their studies raised interesting questions about the nature of contracts and, in particular, the nature of the any contract. In this paper, we develop a model for software contracts that follows Dana Scott’s program by interpreting contracts as projections. The model has already improved our implementation of contracts. We also demonstrate how it increases our understanding of contractoriented programming and design. In particular, our work provides a definitive answer to the questions raised by Blume and McAllester’s work. The key insight from our model that resolves those questions is that a contract that puts no obligation on either party is not the same as the most permissive contract for just one of the parties.
Finally Tagless, Partially Evaluated  Tagless Staged Interpreters for Simpler Typed Languages
"... We have built the first family of tagless interpretations for a higherorder typed object language in a typed metalanguage (Haskell or ML) that require no dependent types, generalized algebraic data types, or postprocessing to eliminate tags. The statically typepreserving interpretations include an ..."
Abstract

Cited by 28 (7 self)
 Add to MetaCart
We have built the first family of tagless interpretations for a higherorder typed object language in a typed metalanguage (Haskell or ML) that require no dependent types, generalized algebraic data types, or postprocessing to eliminate tags. The statically typepreserving interpretations include an evaluator, a compiler (or staged evaluator), a partial evaluator, and callbyname and callbyvalue CPS transformers. Our main idea is to encode HOAS using cogen functions rather than data constructors. In other words, we represent object terms not in an initial algebra but using the coalgebraic structure of the λcalculus. Our representation also simulates inductive maps from types to types, which are required for typed partial evaluation and CPS transformations. Our encoding of an object term abstracts over the various ways to interpret it, yet statically assures that the interpreters never get stuck. To achieve selfinterpretation and show Jonesoptimality, we relate this exemplar of higherrank and higherkind polymorphism to plugging a term into a context of letpolymorphic bindings.
Safe Programming with Pointers through Stateful Views
 In Proceedings of the 7th International Symposium on Practical Aspects of Declarative Languages
, 2005
"... The need for direct memory manipulation through pointers is essential in many applications. However, it is also commonly understood that the use (or probably misuse) of pointers is often a rich source of program errors. Therefore, approaches that can effectively enforce safe use of pointers in pr ..."
Abstract

Cited by 26 (3 self)
 Add to MetaCart
The need for direct memory manipulation through pointers is essential in many applications. However, it is also commonly understood that the use (or probably misuse) of pointers is often a rich source of program errors. Therefore, approaches that can effectively enforce safe use of pointers in programming are highly sought after. ATS is a programming language with a type system rooted in a recently developed framework Applied Type System, and a novel and desirable feature in ATS lies in its support for safe programming with pointers through a novel notion of stateful views. In particular, even pointer arithmetic is allowed in ATS and guaranteed to be safe by the type system of ATS. In this paper, we give an overview of this feature in ATS, presenting some interesting examples based on a prototype implementation of ATS to demonstrate the practicality of safe programming with pointer through stateful views.