Results 1  10
of
22
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 194 (38 self)
 Add to MetaCart
(Show Context)
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 109 (27 self)
 Add to MetaCart
(Show Context)
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.
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 52 (23 self)
 Add to MetaCart
(Show Context)
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.
Free theorems and runtime type representations
 Electron. Notes Theor. Comput. Sci
, 2007
"... Abstract. Reynolds ’ abstraction theorem [21], often referred to as the parametricity theorem, can be used to derive properties about functional programs solely from their types. Unfortunately, in the presence of runtime type analysis, the abstraction properties of polymorphic programs are no longer ..."
Abstract

Cited by 9 (6 self)
 Add to MetaCart
(Show Context)
Abstract. Reynolds ’ abstraction theorem [21], often referred to as the parametricity theorem, can be used to derive properties about functional programs solely from their types. Unfortunately, in the presence of runtime type analysis, the abstraction properties of polymorphic programs are no longer valid. However, runtime type analysis can be implemented with termlevel representations of types, as in the λR language of Crary et al. [10], where case analysis on these runtime representations introduces type refinement. In this paper, we show that representationbased analysis is consistent with type abstraction by extending the abstraction theorem to such a language. We also discuss the “free theorems” that result. This work provides a foundation for the more general problem of extending the abstraction theorem to languages with generalized algebraic datatypes (gadts). 1
Semanticspreserving translations between Linear Concurrent Constraint Programming and Constraint Handling Rules ∗
"... The Constraint Simplification Rules (CSR) subset of CHR and the flat subset of LCC, where agent nesting is restricted, are very close syntactically and semantically. The first contribution of this paper is to provide translations between CSR and flatLCC. The second contribution is a transformation ..."
Abstract

Cited by 5 (2 self)
 Add to MetaCart
(Show Context)
The Constraint Simplification Rules (CSR) subset of CHR and the flat subset of LCC, where agent nesting is restricted, are very close syntactically and semantically. The first contribution of this paper is to provide translations between CSR and flatLCC. The second contribution is a transformation from the full LCC language to flatLCC which preserves semantics. This transformation is similar to λlifting in functional languages. In conjunction with the equivalence between CHR and CSR with respect to original operational semantics, these results lead to semanticspreserving translations from full LCC to CHR and conversely. Immediate consequences of this work include new proofs for CHR linear logic and phase semantics, relying on corresponding results for LCC, plus an encoding of the λcalculus in CHR. 1.
Type processing by constraint reasoning
 Pages 1–25 of: Proc. of APLAS’06. LNCS
, 2006
"... Abstract. Herbrand constraint solving or unification has long been understood as an efficient mechanism for type checking and inference for programs using Hindley/Milner types. If we step back from the particular solving mechanisms used for Hindley/Milner types, and understand type operations in ter ..."
Abstract

Cited by 5 (1 self)
 Add to MetaCart
(Show Context)
Abstract. Herbrand constraint solving or unification has long been understood as an efficient mechanism for type checking and inference for programs using Hindley/Milner types. If we step back from the particular solving mechanisms used for Hindley/Milner types, and understand type operations in terms of constraints we not only give a basis for handling Hindley/Milner extensions, but also gain insight into type reasoning even on pure Hindley/Milner types, particularly for type errors. In this paper we consider typing problems as constraint problems and show which constraint algorithms are required to support various typing questions. We use a light weight constraint reasoning formalism, Constraint Handling Rules, to generate suitable algorithms for many popular extensions to Hindley/Milner types. The algorithms we discuss are all implemented as part of the freely available Chameleon system. 1
Principal type inference for GHCstyle multiparameter type classes
 In Proc. of APLAS’06
, 2006
"... Abstract. We observe that the combination of multiparameter type classes with existential types and type annotations leads to a loss of principal types and undecidability of type inference. This may be a surprising fact for users of these popular features. We conduct a concise investigation of the ..."
Abstract

Cited by 5 (5 self)
 Add to MetaCart
(Show Context)
Abstract. We observe that the combination of multiparameter type classes with existential types and type annotations leads to a loss of principal types and undecidability of type inference. This may be a surprising fact for users of these popular features. We conduct a concise investigation of the problem and are able to give a type inference procedure which, if successful, computes principal types under the conditions imposed by the Glasgow Haskell Compiler (GHC). Our results provide new insights on how to perform type inference for advanced type extensions. 1 Introduction Type systems are important building tools in the design of programming languages. They are typically specified in terms of a set of typing rules which are formulated in natural deduction style. The standard approach towards establishing type soundness is to show that any welltyped program cannot go wrong at runtime. Hence, one of the first tasks of a compiler is to verify whether aprogram is welltyped or not.
Let should not be generalized
, 2009
"... From the dawn of time, all derivatives of the classic HindleyMilner type system have supported implicit generalisation of local letbindings. Yet, as we will show, for more sophisticated type systems implicit letgeneralisation imposes a disproportionate complexity burden. Moreover, it turns out tha ..."
Abstract

Cited by 3 (1 self)
 Add to MetaCart
From the dawn of time, all derivatives of the classic HindleyMilner type system have supported implicit generalisation of local letbindings. Yet, as we will show, for more sophisticated type systems implicit letgeneralisation imposes a disproportionate complexity burden. Moreover, it turns out that the feature is very seldom used, so we propose to eliminate it. The payoff is a substantial simplification, both of the specification of the type system, and of its implementation.
Let should not be generalised
 TLDI'10
, 2010
"... From the dawn of time, all derivatives of the classic HindleyMilner type system have supported implicit generalisation of local letbindings. Yet, as we will show, for more sophisticated type systems implicit letgeneralisation imposes a disproportionate complexity burden. Moreover, it turns out th ..."
Abstract

Cited by 1 (0 self)
 Add to MetaCart
From the dawn of time, all derivatives of the classic HindleyMilner type system have supported implicit generalisation of local letbindings. Yet, as we will show, for more sophisticated type systems implicit letgeneralisation imposes a disproportionate complexity burden. Moreover, it turns out that the feature is very seldom used, so we propose to eliminate it. The payoff is a substantial simplification, both of the specification of the type system, and of its implementation.