Results 1  10
of
17
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 25 (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.
ConstraintBased Type Inference for Guarded Algebraic Data Types
, 2003
"... Guarded algebraic data types, which subsume the concepts known in the literature as indexed types, guarded recursive datatype constructors, and phantom types, and are closely related to inductive types, have the distinguishing feature that, when typechecking a function defined by cases, every branch ..."
Abstract

Cited by 24 (3 self)
 Add to MetaCart
(Show Context)
Guarded algebraic data types, which subsume the concepts known in the literature as indexed types, guarded recursive datatype constructors, and phantom types, and are closely related to inductive types, have the distinguishing feature that, when typechecking a function defined by cases, every branch must be checked under di#erent typing assumptions. This mechanism allows exploiting the presence of dynamic tests in the code to produce extra static type information.
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 23 (10 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
Generalized Algebraic Data Types and ObjectOriented Programming
, 2005
"... Generalized algebraic data types (GADTs) have received much attention recently in the functional programming community. They generalize the (type) parameterized algebraic datatypes (PADTs) of ML and Haskell by permitting value constructors to return specific, rather than parametric, typeinstantiatio ..."
Abstract

Cited by 21 (1 self)
 Add to MetaCart
Generalized algebraic data types (GADTs) have received much attention recently in the functional programming community. They generalize the (type) parameterized algebraic datatypes (PADTs) of ML and Haskell by permitting value constructors to return specific, rather than parametric, typeinstantiations of their own datatype. GADTs have a number of applications, including stronglytyped evaluators, generic prettyprinting, generic traversals and queries, and typed LR parsing. We show that existing objectoriented programming languages such as Java and C ♯ can express GADT definitions, and a large class of GADTmanipulating programs, through the use of generics, subclassing, and virtual dispatch. However, some programs can be written only through the use of redundant runtime casts. Moreover, instantiationspecific, yet safe, operations on ordinary PADTs only admit indirect castfree implementations, via higherorder encodings. We propose a generalization of the type constraint mechanisms of C ♯ and Java to both avoid the need for casts in GADT programs and higherorder contortions in PADT programs; we present a Visitor pattern for GADTs, and describe a refined switch construct as an alternative to virtual dispatch on datatypes. We formalize both extensions and prove type soundness.
The arrow calculus
, 2008
"... Abstract. We introduce the arrow calculus, a metalanguage for manipulating Hughes’s arrows with close relations both to Moggi’s metalanguage for monads and to Paterson’s arrow notation. Arrows are classically defined by extending lambda calculus with three constructs satisfying nine (somewhat idiosy ..."
Abstract

Cited by 19 (5 self)
 Add to MetaCart
(Show Context)
Abstract. We introduce the arrow calculus, a metalanguage for manipulating Hughes’s arrows with close relations both to Moggi’s metalanguage for monads and to Paterson’s arrow notation. Arrows are classically defined by extending lambda calculus with three constructs satisfying nine (somewhat idiosyncratic) laws. In contrast, the arrow calculus adds four constructs satisfying five laws. Two of the constructs are arrow abstraction and application (satisfying beta and eta laws) and two correspond to unit and bind for monads (satisfying left unit, right unit, and associativity laws). The five laws were previously known to be sound; we show that they are also complete, and hence that the five laws may replace the nine. We give a translation from classic arrows into the arrow calculus to complement Paterson’s desugaring and show that the two translations form an equational correspondence in the sense of Sabry and Felleisen. We are also the first to publish formal type rules (which are unusual in that they require two contexts), which greatly aided our understanding of arrows. The first fruit of our new calculus is to reveal some redundancies in the classic formulation: the nine classic arrow laws can be reduced to eight, and the three additional classic arrow laws for arrows with apply can be reduced to two. The calculus has also been used to clarify the relationship between idioms, arrows and monads and as the inspiration for a categorical semantics of arrows. 1
Numbering matters: Firstorder canonical forms for secondorder recursive types
 In Proceedings of the 2004 ACM SIGPLAN International Conference on Functional Programming (ICFP’04
, 2004
"... We study a type system equipped with universal types and equirecursive types, which we refer to as Fµ. We show that type equality may be decided in time O(n log n), an improvement over the previous known bound of O(n 2). In fact, we show that two more general problems, namely entailment of type equa ..."
Abstract

Cited by 15 (2 self)
 Add to MetaCart
(Show Context)
We study a type system equipped with universal types and equirecursive types, which we refer to as Fµ. We show that type equality may be decided in time O(n log n), an improvement over the previous known bound of O(n 2). In fact, we show that two more general problems, namely entailment of type equations and type unification, may be decided in time O(n log n), a new result. To achieve this bound, we associate, with every Fµ type, a firstorder canonical form, which may be computed in time O(n log n). By exploiting this notion, we reduce all three problems to equality and unification of firstorder recursive terms, for which efficient algorithms are known. 1
A FERRYbased query backend for the LINKS programming language
, 2011
"... This thesis describes the implementation of a FERRYbased query backend for the LINKS programming language. In LINKS, queries are seamlessly embedded into the language: Queries formulated in a subset of the language are translated into single SQL queries. LINKS uses static checks to ensure that a ty ..."
Abstract

Cited by 12 (1 self)
 Add to MetaCart
This thesis describes the implementation of a FERRYbased query backend for the LINKS programming language. In LINKS, queries are seamlessly embedded into the language: Queries formulated in a subset of the language are translated into single SQL queries. LINKS uses static checks to ensure that a typecorrect query expression can be translated into an equivalent SQL query and allows abstraction over parts of a query. The queryizable subset of LINKS is, however, severely limited in terms of supported functions and the data type (limited to bags of flat records) of queries. The thesis begins with a description of the query facility and criticizes the limited functionality of the queryizable LINKS subset. The FERRY framework deals with the compilation of pure, declarative languages based on list comprehensions into SQL queries. It provides features that LINKS queries are lacking: query results involving nested lists and computed by a small, statically bounded number of SQL queries, ordered lists semantics and a larger number of supported functions. The thesis first reviews the compilation technique of the FERRY framework and adapts it to the specifics of LINKS. The queryizable subset of LINKS is higherorder and allows to treat functions as firstclass values. To keep this property in the new query backend, the
FirstClass Functions for FirstOrder Database Engines
 In Proc. DBPL
, 2013
"... We describe query defunctionalization which enables offtheshelf firstorder database engines to process queries over firstclass functions. Support for firstclass functions is characterized by the ability to treat functions like regular data items that can be constructed at query runtime, passed ..."
Abstract

Cited by 6 (1 self)
 Add to MetaCart
We describe query defunctionalization which enables offtheshelf firstorder database engines to process queries over firstclass functions. Support for firstclass functions is characterized by the ability to treat functions like regular data items that can be constructed at query runtime, passed to or returned from other (higherorder) functions, assigned to variables, and stored in persistent data structures. Query defunctionalization is a noninvasive approach that transforms such functioncentric queries into the datacentric operations implemented by common query processors. Experiments with XQuery and PL/SQL database systems demonstrate that firstorder database engines can faithfully and efficiently support the expressive “functions as data ” paradigm. 1. Functions Should be FirstClass Since the early working drafts of 2001, XQuery’s syntax and
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
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
Types for describing coordinated data structures
 In ACM SIGPLAN International Workshop on Types in Languages, Design and Implementation (TLDI
, 2005
"... Coordinated data structures are sets of (perhaps unbounded) data structures where the nodes of each structure may share abstract types with the corresponding nodes of the other structures. For example, consider a list of arguments, and a separate list of functions, where the nth function of the sec ..."
Abstract

Cited by 4 (0 self)
 Add to MetaCart
Coordinated data structures are sets of (perhaps unbounded) data structures where the nodes of each structure may share abstract types with the corresponding nodes of the other structures. For example, consider a list of arguments, and a separate list of functions, where the nth function of the second list should be applied only to the nth argument of the first list. We can guarantee that this invariant is obeyed by coordinating the two lists, such that the type of the nth argument is existentially quantified and identical to the argument type of the nth function. In this paper, we describe a minimal set of features sufficient for a type system to support coordinated data structures. We also demonstrate that two known type systems (Crary and Weirich’s LX [6] and Xi, Chen and Chen’s guarded recursive datatypes [24]) have these features, even though the systems were developed for other purposes. We illustrate the power of coordinated data structures as a programming idiom with three examples: (1) a list of function closures stored as a list of environments and a separate list of code pointers, (2) a “tagless ” list, and (3) a redblack tree where the values and colors are stored in separate trees that are guaranteed to have the same shape.