Results 1 - 10
of
27
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 34 (10 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
Comparing Libraries for Generic Programming in Haskell
, 2008
"... Datatype-generic 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 12 (7 self)
- Add to MetaCart
Datatype-generic 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 datatype-generic 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 datatype-generic programming.
Comparing approaches to generic programming in Haskell
- ICS, Utrecht University
, 2006
"... Abstract. The last decade has seen a number of approaches to datatype-generic programming: PolyP, Functorial ML, ‘Scrap Your Boilerplate’, Generic Haskell, ‘Generics for the Masses’, etc. The approaches vary in sophistication and target audience: some propose full-blown programming languages, some s ..."
Abstract
-
Cited by 10 (3 self)
- Add to MetaCart
Abstract. The last decade has seen a number of approaches to datatype-generic programming: PolyP, Functorial ML, ‘Scrap Your Boilerplate’, Generic Haskell, ‘Generics for the Masses’, etc. The approaches vary in sophistication and target audience: some propose full-blown programming languages, some suggest libraries, some can be seen as categorical programming methods. In these lecture notes we compare the various approaches to datatype-generic programming in Haskell. We introduce each approach by means of example, and we evaluate it along different dimensions (expressivity, ease of use, etc). 1
Strongly typed rewriting for coupled software transformation
- Proc. 7th Int. Workshop on Rule-Based 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 8 (3 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, type-changing 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 type-safely by a generalized abstract data type (GADT). These representations are then subjected to program calculation rules, harnessed in typesafe, type-preserving strategic rewrite systems. For ease of calculation, we use point-free representations and corresponding calculation rules. Thus, coupled transformations are carried out in two steps. First, a type-changing 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 type-preserving 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 type-safe. Key words: Program transformation, term rewriting, strategic programming, generalized abstract datatypes, data refinement.
A generic programming toolkit for PADS/ML: First-class upgrades for third-party developers
- In PADL
, 2008
"... Abstract. Domain-specific languages facilitate solving problems in a targeted domain by providing features particular to the domain. Declarative domain-specific languages have the additional benefit that users specify what something means rather than how to do something. As a result, the language co ..."
Abstract
-
Cited by 8 (5 self)
- Add to MetaCart
Abstract. Domain-specific languages facilitate solving problems in a targeted domain by providing features particular to the domain. Declarative domain-specific languages have the additional benefit that users specify what something means rather than how to do something. As a result, the language compiler is free to choose the best implementation strategies and to generate multiple artifacts from a single description. PADS/ML is a declarative data description language designed to facilitate ad hoc data management. From a single description, the compiler generates a myriad of artifacts, including data structures for the in-memory representation of the data and parsers and printers. In this paper, we describe a new generic programming infrastructure for PADS/ML that allows third-party developers to define additional useful artifacts without modifying the compiler. We report on two case studies that use this infrastructure. In the first, we build a version of PADX for PADS/ML, allowing any data source with a PADS/ML description to be queried as if it were XML. In the second, we extend Harmony with the ability to synchronize any data with a PADS/ML description. 1
Scala for generic programmers
- ACM SIGPLAN Workshop on Generic Programming
, 2008
"... Datatype-generic programming involves parametrization by the shape of data, in the form of type constructors such as ‘list of’. Most approaches to datatype-generic programming are developed in the lazy functional programming language Haskell. We argue that the functional object-oriented language Sca ..."
Abstract
-
Cited by 5 (2 self)
- Add to MetaCart
Datatype-generic programming involves parametrization by the shape of data, in the form of type constructors such as ‘list of’. Most approaches to datatype-generic programming are developed in the lazy functional programming language Haskell. We argue that the functional object-oriented language Scala is in many ways a better setting. Not only does Scala provide equivalents of all the necessary functional programming features (such parametric polymorphism, higher-order functions, higher-kinded type operations, and type- and constructor-classes), but it also provides the most useful features of object-oriented languages (such as subtyping, overriding, traditional single inheritance, and multiple inheritance in the form of traits). We show how this combination of features benefits datatype-generic programming, using three different approaches as illustrations.
Generics as a Library
- Proceedings of the Seventh Symposium on Trends in Functional Programming
, 2006
"... A generic function is a function that is defined on the structure of data types: with a single definition, we obtain a function that works for many data types. In contrast, an ad-hoc polymorphic function requires a separate implementation for each data type. Previous work by Hinze on lightweight ..."
Abstract
-
Cited by 4 (4 self)
- Add to MetaCart
A generic function is a function that is defined on the structure of data types: with a single definition, we obtain a function that works for many data types. In contrast, an ad-hoc polymorphic function requires a separate implementation for each data type. Previous work by Hinze on lightweight generic programming has introduced techniques that allow the definition of generic functions directly in Haskell.
Dynamic applications from the ground up
- In ACM SIGPLAN Haskell WS
, 2005
"... Abstract Some Lisp programs such as Emacs, but also the Linux kernel(when fully modularised) are mostly dynamic; i.e., apart from ..."
Abstract
-
Cited by 3 (0 self)
- Add to MetaCart
Abstract Some Lisp programs such as Emacs, but also the Linux kernel(when fully modularised) are mostly dynamic; i.e., apart from
Parametric Datatype-Genericity
"... Datatype-generic programs are programs that are parametrized by a datatype or type functor: whereas polymorphic programs abstract from the ‘integers ’ in ‘lists of integers’, datatype-generic programs abstract from the ‘lists of’. There are two main styles of datatype-generic programming: the Algebr ..."
Abstract
-
Cited by 3 (1 self)
- Add to MetaCart
Datatype-generic programs are programs that are parametrized by a datatype or type functor: whereas polymorphic programs abstract from the ‘integers ’ in ‘lists of integers’, datatype-generic programs abstract from the ‘lists of’. There are two main styles of datatype-generic programming: the Algebra of Programming approach, characterized by structured recursion operators arising from initial algebras and final coalgebras, and the Generic Haskell approach, characterized by case analysis over the structure of a datatype. We show that the former enjoys a kind of higherorder naturality, relating the behaviours of generic functions at different types; in contrast, the latter is ad hoc, with no coherence required or provided between the various clauses of a definition. Moreover, the naturality properties arise ‘for free’, simply from the parametrized types of the generic functions: we present a higherorder parametricity theorem for datatype-generic operators. Categories and Subject Descriptors D.3.3 [Programming languages]: Language constructs and features—Polymorphism, patterns, control structures, recursion; F.3.3 [Logics and meanings of programs]: Studies of program constructs—Program and recursion schemes, type structure; F.3.2 [Logics and meanings of programs]: Semantics of programming languages—Algebraic approaches to semantics; D.3.2 [Programming languages]: Language classifications—Functional languages.
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? Datatype-generic programming promises to end these coding nightmares. In these lecture notes, we present the key abstractions of datatype-generic 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? Datatype-generic programming promises to end these coding nightmares. In these lecture notes, we present the key abstractions of datatype-generic 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

