Results 1  10
of
35
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 115 (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
Associated Types with Class
 In POPL ’05: Proceedings of the 32nd ACM SIGPLANSIGACT symposium on Principles of programming languages
, 2005
"... In this paper, we explore an extension to Haskell type classes that allows a type class declaration to define data types as well as values (or methods). Similarly, an instance declaration gives a witness for such data types, as well as a witness for each method. It turns out that this extension dire ..."
Abstract

Cited by 93 (25 self)
 Add to MetaCart
(Show Context)
In this paper, we explore an extension to Haskell type classes that allows a type class declaration to define data types as well as values (or methods). Similarly, an instance declaration gives a witness for such data types, as well as a witness for each method. It turns out that this extension directly supports the idea of a typeindexed type, and is useful in many applications, especially for selfoptimising libraries that adapt their data representations and algorithms in a typedirected manner.
TypeIndexed Data Types
 SCIENCE OF COMPUTER PROGRAMMING
, 2004
"... A polytypic function is a function that can be instantiated on many data types to obtain data type specific functionality. Examples of polytypic functions are the functions that can be derived in Haskell, such as show , read , and ` '. More advanced examples are functions for digital searching, ..."
Abstract

Cited by 61 (23 self)
 Add to MetaCart
A polytypic function is a function that can be instantiated on many data types to obtain data type specific functionality. Examples of polytypic functions are the functions that can be derived in Haskell, such as show , read , and ` '. More advanced examples are functions for digital searching, pattern matching, unification, rewriting, and structure editing. For each of these problems, we not only have to define polytypic functionality, but also a typeindexed data type: a data type that is constructed in a generic way from an argument data type. For example, in the case of digital searching we have to define a search tree type by induction on the structure of the type of search keys. This paper shows how to define typeindexed data types, discusses several examples of typeindexed data types, and shows how to specialize typeindexed data types. The approach has been implemented in Generic Haskell, a generic programming extension of the functional language Haskell.
A Generic Programming Extension for Haskell
 Utrecht University
, 1999
"... Many functions can be dened completely generically for all datatypes. Examples include pretty printers (eg show), parsers (eg read), data converters, equality and comparison functions, mapping functions, and so forth. This paper proposes a generic programming extension that enables the user to dene ..."
Abstract

Cited by 41 (5 self)
 Add to MetaCart
(Show Context)
Many functions can be dened completely generically for all datatypes. Examples include pretty printers (eg show), parsers (eg read), data converters, equality and comparison functions, mapping functions, and so forth. This paper proposes a generic programming extension that enables the user to dene such functions in Haskell. In particular, the proposal aims at generalizing Haskell's deriving construct, which is commonly considered decient since instance declarations can only be derived for a few predened classes. Using generic denitions derived instances can be specied for arbitrary userdened type classes and for classes that abstract over type constructors of rstorder kind. 1 Introduction Generic or polytypic programming aims at relieving the programmer from repeatedly writing functions of similar functionality for dierent datatypes. Typical examples for socalled generic functions include pretty printers (eg show), parsers (eg read), functions that convert data into a u...
Generic Haskell: applications
 In Generic Programming, Advanced Lectures, volume 2793 of LNCS
, 2003
"... Generic Haskell is an extension of Haskell that supports the construction of generic programs. These lecture notes discuss three advanced generic programming applications: generic dictionaries, compressing XML documents, and the zipper: a data structure used to represent a tree together with a s ..."
Abstract

Cited by 31 (15 self)
 Add to MetaCart
(Show Context)
Generic Haskell is an extension of Haskell that supports the construction of generic programs. These lecture notes discuss three advanced generic programming applications: generic dictionaries, compressing XML documents, and the zipper: a data structure used to represent a tree together with a subtree that is the focus of attention, where that focus may move left, right, up or down the tree. When describing and implementing these examples, we will encounter some advanced features of Generic Haskell, such as typeindexed data types, dependencies between and generic abstractions of generic functions, adjusting a generic function using a default case, and generic functions with a special case for a particular constructor.
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 i ..."
Abstract

Cited by 27 (11 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.
Systematic search for lambda expressions
 In Proceedings Sixth Symposium on Trends in Functional Programming (TFP2005
, 2005
"... This paper presents a system for searching for desired small functional programs by just generating a sequence of typecorrect programs in a systematic and exhaustive manner and evaluating them. The main goal of this line of research is to ease functional programming, along with the subgoal to provi ..."
Abstract

Cited by 25 (1 self)
 Add to MetaCart
(Show Context)
This paper presents a system for searching for desired small functional programs by just generating a sequence of typecorrect programs in a systematic and exhaustive manner and evaluating them. The main goal of this line of research is to ease functional programming, along with the subgoal to provide an axis to evaluate heuristic approaches to program synthesis such as genetic programming by telling the best performance possible by exhaustive search algorithms. While our previous approach to that goal used combinatory expressions in order to simplify the synthesis process, which led to redundant combinator expressions with complex types, this time we use de Bruijn lambda expressions and enjoy improved results. 1
Comparing Libraries for Generic Programming in Haskell
, 2008
"... Datatypegeneric programming is defining functions that depend on the structure, or “shape”, of datatypes. It has been around for more than 10 years, and a lot of progress has been made, in particular in the lazy functional programming language Haskell. There are more than 10 proposals for generic p ..."
Abstract

Cited by 21 (8 self)
 Add to MetaCart
Datatypegeneric programming is defining functions that depend on the structure, or “shape”, of datatypes. It has been around for more than 10 years, and a lot of progress has been made, in particular in the lazy functional programming language Haskell. There are more than 10 proposals for generic programming libraries or language extensions for Haskell. To compare and characterize the many generic programming libraries in a typed functional language, we introduce a set of criteria and develop a generic programming benchmark: a set of characteristic examples testing various facets of datatypegeneric programming. We have implemented the benchmark for nine existing Haskell generic programming libraries and present the evaluation of the libraries. The comparison is useful for reaching a common standard for generic programming, but also for a programmer who has to choose a particular approach for datatypegeneric programming.
Polytypic Programming With Ease
, 1999
"... A functional polytypic program is one that is parameterised by datatype. Since polytypic functions are defined by induction on types rather than by induction on values they typically operate on a higher level of abstraction than their monotypic counterparts. However, polytypic programming is not nec ..."
Abstract

Cited by 15 (5 self)
 Add to MetaCart
(Show Context)
A functional polytypic program is one that is parameterised by datatype. Since polytypic functions are defined by induction on types rather than by induction on values they typically operate on a higher level of abstraction than their monotypic counterparts. However, polytypic programming is not necessarily more complicated than conventional programming. We show that a polytypic function is uniquely defined by its action on constant functors, projection functors, sums, and products. This information is sufficient to specialize a polytypic function to arbitrary polymorphic datatypes, including mutually recursive datatypes and nested datatypes. The key idea is to use infinite trees as index sets for polytypic functions and to interpret datatypes as algebraic trees. This approach appears both to be simpler, more general, and more efficient than previous ones which are based on the initial algebra semantics of datatypes. Polytypic functions enjoy polytypic properties. We show that wellkno...
Semicontinuous sized types and termination
 In Zoltán Ésik, editor, Computer Science Logic, 20th International Workshop, CSL 2006, 15th Annual Conference of the EACSL
"... Abstract. Some typebased approaches to termination use sized types: an ordinal bound for the size of a data structure is stored in its type. A recursive function over a sized type is accepted if it is visible in the type system that recursive calls occur just at a smaller size. This approach is onl ..."
Abstract

Cited by 15 (5 self)
 Add to MetaCart
Abstract. Some typebased approaches to termination use sized types: an ordinal bound for the size of a data structure is stored in its type. A recursive function over a sized type is accepted if it is visible in the type system that recursive calls occur just at a smaller size. This approach is only sound if the type of the recursive function is admissible, i.e., depends on the size index in a certain way. To explore the space of admissible functions in the presence of higherkinded data types and impredicative polymorphism, a semantics is developed where sized types are interpreted as functions from ordinals into sets of strongly normalizing terms. It is shown that upper semicontinuity of such functions is a sufficient semantic criterion for admissibility. To provide a syntactical criterion, a calculus for semicontinuous functions is developed. 1.