Results 1 
9 of
9
Generic Haskell: practice and theory
 In Generic Programming, Advanced Lectures, volume 2793 of LNCS
, 2003
"... Abstract. Generic Haskell is an extension of Haskell that supports the construction of generic programs. These lecture notes describe the basic constructs of Generic Haskell and highlight the underlying theory. Generic programming aims at making programming more effective by making it more general. ..."
Abstract

Cited by 65 (23 self)
 Add to MetaCart
Abstract. Generic Haskell is an extension of Haskell that supports the construction of generic programs. These lecture notes describe the basic constructs of Generic Haskell and highlight the underlying theory. Generic programming aims at making programming more effective by making it more general. Generic programs often embody nontraditional kinds of polymorphism. Generic Haskell is an extension of Haskell [38] that supports the construction of generic programs. Generic Haskell adds to Haskell the notion of structural polymorphism, the ability to define a function (or a type) by induction on the structure of types. Such a function is generic in the sense that it works not only for a specific type but for a whole class of types. Typical examples include equality, parsing and pretty printing, serialising, ordering, hashing, and so on. The lecture notes on Generic Haskell are organized into two parts. This first part motivates the need for genericity, describes the basic constructs of Generic Haskell, puts Generic Haskell into perspective, and highlights the underlying theory. The second part entitled “Generic Haskell: applications ” delves deeper into the language discussing three nontrivial applications of Generic Haskell: generic dictionaries, compressing XML documents, and a generic version of the zipper data type. The first part is organized as follows. Section 1 provides some background discussing type systems in general and the type system of Haskell in particular. Furthermore, it motivates the basic constructs of Generic Haskell. Section 2 takes a closer look at generic definitions and shows how to define some popular generic functions. Section 3 highlights the theory underlying Generic Haskell and discusses its implementation. Section 4 concludes. 1
Generalizing Generalized Tries
, 1999
"... A trie is a search tree scheme that employs the structure of search keys to organize information. Tries were originally devised as a means to represent a collection of records indexed by strings over a fixed alphabet. Based on work by C.P. Wadsworth and others, R.H. Connelly and F.L. Morris generali ..."
Abstract

Cited by 31 (8 self)
 Add to MetaCart
A trie is a search tree scheme that employs the structure of search keys to organize information. Tries were originally devised as a means to represent a collection of records indexed by strings over a fixed alphabet. Based on work by C.P. Wadsworth and others, R.H. Connelly and F.L. Morris generalized the concept to permit indexing by elements of an arbitrary monomorphic datatype. Here we go one step further and define tries and operations on tries generically for arbitrary firstorder polymorphic datatypes. The derivation is based on techniques recently developed in the context of polytypic programming. It is well known that for the implementation of generalized tries nested datatypes and polymorphic recursion are needed. Implementing tries for polymorphic datatypes places even greater demands on the type system: it requires rank2 type signatures and higherorder polymorphic nested datatypes. Despite these requirements the definition of generalized tries for polymorphic datatypes is...
Manufacturing Datatypes
, 1999
"... This paper describes a general framework for designing purely functional datatypes that automatically satisfy given size or structural constraints. Using the framework we develop implementations of different matrix types (eg square matrices) and implementations of several tree types (eg Braun trees, ..."
Abstract

Cited by 24 (3 self)
 Add to MetaCart
This paper describes a general framework for designing purely functional datatypes that automatically satisfy given size or structural constraints. Using the framework we develop implementations of different matrix types (eg square matrices) and implementations of several tree types (eg Braun trees, 23 trees). Consider, for instance, representing square n \Theta n matrices. The usual representation using lists of lists fails to meet the structural constraints: there is no way to ensure that the outer list and the inner lists have the same length. The main idea of our approach is to solve in a first step a related, but simpler problem, namely to generate the multiset of all square numbers. In order to describe this multiset we employ recursion equations involving finite multisets, multiset union, addition and multiplication lifted to multisets. In a second step we mechanically derive datatype definitions from these recursion equations which enforce the `squareness' constraint. The tra...
Specifying pointer structures by graph reduction
, 2003
"... Abstract. Graph reduction specifications (GRSs) are a powerful new method for specifying classes of pointer data structures (shapes). They cover important shapes, like various forms of balanced trees, that cannot be handled by existing methods. This paper formally defines GRSs as graph reduction sys ..."
Abstract

Cited by 18 (6 self)
 Add to MetaCart
Abstract. Graph reduction specifications (GRSs) are a powerful new method for specifying classes of pointer data structures (shapes). They cover important shapes, like various forms of balanced trees, that cannot be handled by existing methods. This paper formally defines GRSs as graph reduction systems with a signature restriction and an accepting graph. We are mainly interested in PGRSs — polynomiallyterminating GRSs whose graph languages are closed under reduction and have a polynomial membership test. We investigate the power of the PGRS framework by presenting example specifications and by considering its language closure properties: PGRS languages are closed under intersection; not closed under union (unless we drop the closedness restriction and exclude languages with the empty graph); and not closed under complement. Our practical investigation presents example PGRSs including cyclic lists, trees, balanced trees and redblack trees. In each case we try to make the PGRS as simple as possible where simpler means fewer rules, simpler termination and closure proofs and fewer nonterminals. We show how to prove the correctness of a PGRS and give methods for demonstrating that a given shape cannot be specified by a PGRS with certain simplicity properties. 1
Comparing approaches to generic programming in Haskell
 ICS, Utrecht University
, 2006
"... Abstract. The last decade has seen a number of approaches to datatypegeneric programming: PolyP, Functorial ML, ‘Scrap Your Boilerplate’, Generic Haskell, ‘Generics for the Masses’, etc. The approaches vary in sophistication and target audience: some propose fullblown programming languages, some s ..."
Abstract

Cited by 14 (4 self)
 Add to MetaCart
Abstract. The last decade has seen a number of approaches to datatypegeneric programming: PolyP, Functorial ML, ‘Scrap Your Boilerplate’, Generic Haskell, ‘Generics for the Masses’, etc. The approaches vary in sophistication and target audience: some propose fullblown programming languages, some suggest libraries, some can be seen as categorical programming methods. In these lecture notes we compare the various approaches to datatypegeneric programming in Haskell. We introduce each approach by means of example, and we evaluate it along different dimensions (expressivity, ease of use, etc). 1
Initial algebra semantics is enough
 Proceedings, Typed Lambda Calculus and Applications
, 2007
"... Abstract. Initial algebra semantics is a cornerstone of the theory of modern functional programming languages. For each inductive data type, it provides a fold combinator encapsulating structured recursion over data of that type, a Church encoding, a build combinator which constructs data of that ty ..."
Abstract

Cited by 8 (5 self)
 Add to MetaCart
Abstract. Initial algebra semantics is a cornerstone of the theory of modern functional programming languages. For each inductive data type, it provides a fold combinator encapsulating structured recursion over data of that type, a Church encoding, a build combinator which constructs data of that type, and a fold/build rule which optimises modular programs by eliminating intermediate data of that type. It has long been thought that initial algebra semantics is not expressive enough to provide a similar foundation for programming with nested types. Specifically, the folds have been considered too weak to capture commonly occurring patterns of recursion, and no Church encodings, build combinators, or fold/build rules have been given for nested types. This paper overturns this conventional wisdom by solving all of these problems. 1
Generic programming, now
 Generic Programming, Advanced Lectures, LNCS
, 2006
"... Abstract. Tired of writing boilerplate code? Tired of repeating essentially the same function definition for lots of different datatypes? Datatypegeneric programming promises to end these coding nightmares. In these lecture notes, we present the key abstractions of datatypegeneric programming, giv ..."
Abstract

Cited by 3 (1 self)
 Add to MetaCart
Abstract. Tired of writing boilerplate code? Tired of repeating essentially the same function definition for lots of different datatypes? Datatypegeneric programming promises to end these coding nightmares. In these lecture notes, we present the key abstractions of datatypegeneric programming, give several applications, and provide an elegant embedding of generic programming into Haskell. The embedding builds on recent advances in type theory: generalised algebraic datatypes and open datatypes. We hope to convince you that generic programming is useful and that you can use generic programming techniques today! 1
Yet Another Generic Haskell
"... In previous work, we invented the notion of functional strategies, that is, firstclass generic functions which can traverse into terms of any type while mixing uniform and typespecific behaviour. In the present paper, we reconstruct functional strategies in Haskell in an extremely compact style re ..."
Abstract
 Add to MetaCart
In previous work, we invented the notion of functional strategies, that is, firstclass generic functions which can traverse into terms of any type while mixing uniform and typespecific behaviour. In the present paper, we reconstruct functional strategies in Haskell in an extremely compact style relying on just two combinators: adhoc for typebased function dispatch, and hfoldr for folding over constructor applications. This reconstruction constitutes yet another way to turn Haskell into a (more) generic programming language. Our approach is lightweight (both for language users and implementors) , highly expressive, wellfounded, and has already proven its value in important application domains.
Haskell Programming with Nested Types: A Principled Approach †
"... Abstract. Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured r ..."
Abstract
 Add to MetaCart
Abstract. Initial algebra semantics is one of the cornerstones of the theory of modern functional programming languages. For each inductive data type, it provides a Church encoding for that type, a build combinator which constructs data of that type, a fold combinator which encapsulates structured recursion over data of that type, and a fold/build rule which optimises modular programs by eliminating from them data constructed using the build combinator, and immediately consumed using the fold combinator, for that type. It has long been thought that initial algebra semantics is not expressive enough to provide a similar foundation for programming with nested types in Haskell. Specifically, the standard folds derived from initial algebra semantics have been considered too weak to capture commonly occurring patterns of recursion over data of nested types in Haskell, and no build combinators or fold/build rules have until now been defined for nested types. This paper shows that standard folds are, in fact, sufficiently expressive for programming with nested types in Haskell. It also defines build combinators and fold/build fusion rules for nested types. It thus shows how initial algebra semantics provides a principled, expressive, and elegant foundation for programming with nested types in Haskell. 1.