Results 1  10
of
26
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 157 (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.
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
Practical Implementation of a Dependently Typed Functional Programming Language
, 2005
"... Language ..."
TypeCase: A Design Pattern for TypeIndexed Functions
, 2005
"... A typeindexed function is a function that is defined for each member of some family of types. Haskell's type class mechanism provides collections of open typeindexed functions, in which the indexing family can be extended by defining a new type class instance but the collection of functions is fix ..."
Abstract

Cited by 25 (10 self)
 Add to MetaCart
A typeindexed function is a function that is defined for each member of some family of types. Haskell's type class mechanism provides collections of open typeindexed functions, in which the indexing family can be extended by defining a new type class instance but the collection of functions is fixed. The purpose of this paper is to present TypeCase: a design pattern that allows the definition of closed typeindexed functions, in which the index family is fixed but the collection of functions is extensible. It is inspired by Cheney and Hinze's work on lightweight approaches to generic programming. We generalise their techniques as a design pattern. Furthermore, we show that typeindexed functions with typeindexed types, and consequently generic functions with generic types, can also be encoded in a lightweight manner, thereby overcoming one of the main limitations of the lightweight approaches.
A constraintbased approach to guarded algebraic data types
 ACM Trans. Prog. Languages Systems
, 2007
"... We study HMG(X), an extension of the constraintbased type system HM(X) with deep pattern matching, polymorphic recursion, and guarded algebraic data types. Guarded algebraic data types subsume the concepts known in the literature as indexed types, guarded recursive datatype constructors, (firstcla ..."
Abstract

Cited by 24 (0 self)
 Add to MetaCart
We study HMG(X), an extension of the constraintbased type system HM(X) with deep pattern matching, polymorphic recursion, and guarded algebraic data types. Guarded algebraic data types subsume the concepts known in the literature as indexed types, guarded recursive datatype constructors, (firstclass) phantom types, and equality qualified types, and are closely related to inductive types. Their characteristic property is to allow every branch of a case construct to be typechecked under different assumptions about the type variables in scope. We prove that HMG(X) is sound and that, provided recursive definitions carry a type annotation, type inference can be reduced to constraint solving. Constraint solving is decidable, at least for some instances of X, but prohibitively expensive. Effective type inference for guarded algebraic data types is left as an issue for future research.
A framework for extended algebraic data types
 In Proc. of FLOPS’06, volume 3945 of LNCS
, 2006
"... Abstract. There are a number of extended forms of algebraic data types such as type classes with existential types and generalized algebraic data types. Such extensions are highly useful but their interaction has not been studied formally so far. Here, we present a unifying framework for these exten ..."
Abstract

Cited by 22 (9 self)
 Add to MetaCart
Abstract. There are a number of extended forms of algebraic data types such as type classes with existential types and generalized algebraic data types. Such extensions are highly useful but their interaction has not been studied formally so far. Here, we present a unifying framework for these extensions. We show that the combination of type classes and generalized algebraic data types allows us to express a number of interesting properties which are desired by programmers. We support type checking based on a novel constraint solver. Our results show that our system is practical and greatly extends the expressive power of languages such as Haskell and ML. 1
Typed contracts for functional programming
 In FLOPS ’06: Functional and Logic Programming: 8th International Symposium
, 2006
"... Abstract. A robust software component fulfills a contract: it expects data satisfying a certain property and promises to return data satisfying another property. The objectoriented community uses the designbycontract approach extensively. Proposals for language extensions that add contracts to hig ..."
Abstract

Cited by 22 (0 self)
 Add to MetaCart
Abstract. A robust software component fulfills a contract: it expects data satisfying a certain property and promises to return data satisfying another property. The objectoriented community uses the designbycontract approach extensively. Proposals for language extensions that add contracts to higherorder functional programming have appeared recently. In this paper we propose an embedded domainspecific language for typed, higherorder and firstclass contracts, which is both more expressive than previous proposals, and allows for a more informative blame assignment. We take some first steps towards an algebra of contracts, and we show how to define a generic contract combinator for arbitrary algebraic data types. The contract language is implemented as a library in Haskell using the concept of generalised algebraic data types. 1
Towards efficient, typed LR parsers
 In ACM SIGPLAN Workshop on ML, Electronic Notes in Theoretical Computer Science
, 2005
"... Abstract The LR parser generators that are bundled with many functional programming language implementations produce code that is untyped, needlessly inefficient, or both. We show that, using generalized algebraic data types, it is possible to produce parsers that are welltyped (so they cannot unex ..."
Abstract

Cited by 16 (8 self)
 Add to MetaCart
Abstract The LR parser generators that are bundled with many functional programming language implementations produce code that is untyped, needlessly inefficient, or both. We show that, using generalized algebraic data types, it is possible to produce parsers that are welltyped (so they cannot unexpectedly crash or fail) and nevertheless efficient. This is a pleasing result as well as an illustration of the new expressiveness offered by generalized algebraic data types.
Type inference for guarded recursive data types
, 2005
"... Abstract. We consider type inference for guarded recursive data types (GRDTs) – a recent generalization of algebraic data types. We reduce type inference for GRDTs to unification under a mixed prefix. Thus, we obtain efficient type inference. Inference is incomplete because the set of type constrai ..."
Abstract

Cited by 16 (0 self)
 Add to MetaCart
Abstract. We consider type inference for guarded recursive data types (GRDTs) – a recent generalization of algebraic data types. We reduce type inference for GRDTs to unification under a mixed prefix. Thus, we obtain efficient type inference. Inference is incomplete because the set of type constraints allowed to appear in the type system is only a subset of those type constraints generated by type inference. Hence, inference only succeeds if the program is sufficiently type annotated. We present refined procedures to infer types incrementally and to assist the user in identifying which pieces of type information are missing. Additionally, we introduce procedures to test if a type is not principal and to find a principal type if one exists. 1
Strongly typed rewriting for coupled software transformation
 Proc. 7th Int. Workshop on RuleBased Programming (RULE 2006), ENTCS
, 2006
"... Coupled transformations occur in software evolution when multiple artifacts must be modified in such a way that they remain consistent with each other. An important example involves the coupled transformation of a data type, its instances, and the programs that consume or produce it. Previously, we ..."
Abstract

Cited by 12 (4 self)
 Add to MetaCart
Coupled transformations occur in software evolution when multiple artifacts must be modified in such a way that they remain consistent with each other. An important example involves the coupled transformation of a data type, its instances, and the programs that consume or produce it. Previously, we have provided a formal treatment of transformation of the first two: data types and instances. The treatment involved the construction of typesafe, typechanging strategic rewrite systems. In this paper, we extend our treatment to the transformation of corresponding data processing programs. The key insight underlying the extension is that both data migration functions and data processors can be represented typesafely by a generalized abstract data type (GADT). These representations are then subjected to program calculation rules, harnessed in typesafe, typepreserving strategic rewrite systems. For ease of calculation, we use pointfree representations and corresponding calculation rules. Thus, coupled transformations are carried out in two steps. First, a typechanging rewrite system is applied to a source type to obtain a target type together with (representations of) migration functions between source and target. Then, a typepreserving rewrite system is applied to the composition of a migration function and a data processor on the source (or target) type to obtain a data processor on the target (or source) type. All rewrites are typesafe. Key words: Program transformation, term rewriting, strategic programming, generalized abstract datatypes, data refinement.