Alloy: fast generic transformations for Haskell

@inproceedings{Brown2009AlloyFG,
  title={Alloy: fast generic transformations for Haskell},
  author={Neil Brown and Adam T. Sampson},
  booktitle={Haskell},
  year={2009}
}
Data-type generic programming can be used to traverse and manipulate specific parts of large heterogeneously-typed tree structures, without the need for tedious boilerplate. Generic programming is often approached from a theoretical perspective, where the emphasis lies on the power of the representation rather than on efficiency. We describe use cases for a generic system derived from our work on a nanopass compiler, where efficiency is a real concern, and detail a new generics approach (Alloy… 

Figures and Tables from this paper

Comparing Datatype Generic Libraries in Haskell 3
TLDR
This paper develops a generic programming benchmark: a set of characteristic examples testing various facets of datatype-generic programming, and implements the benchmark for ten existing Haskell generic programming libraries and presents the evaluation of the libraries.
Optimizing generics is easy!
TLDR
An extensive benchmark suite for generic functions is presented and it is confirmed that generic programs, when compiled with the standard optimization flags of the Glasgow Haskell Compiler (GHC), are substantially slower than their hand-written counterparts, but it is also found that more advanced optimization capabilities of GHC can be used to further optimize generic functions.
Comparing Datatype Generic Libraries in Haskell
TLDR
This paper develops a generic programming benchmark: a set of characteristic examples testing various facets of datatype-generic programming, and implements the benchmark for ten existing Haskell generic programming libraries and presents the evaluation of the libraries.
Scala for generic programmers
TLDR
It is argued that the functional object-oriented language Scala is in many ways a better setting for datatype-generic programming, because it provides equivalents of all the necessary functional programming features and also provides the most useful features of object- oriented languages.
The Kansas University rewrite engine
TLDR
KURE's approach to assigning types to generic traversals, and the implementation of that approach are described, which compare KURE, its design choices, and their consequences, with other approaches to strategic and datatype-generic programming.
Optimizing SYB is easy!
TLDR
This paper optimizes SYB-style traversals to be as fast as handwritten, non-generic code, and benchmarks show that this optimization improves the speed of SYB -style code by an order of magnitude or more.
Optimizing SYB traversals is easy!
Guppy: Process-Oriented Programming on Embedded Devices
TLDR
This paper reports on a variety of aspects related to this, specifically language, compiler and run-time system development, enabling Guppy programs to run on desktop and embedded systems.
Template your boilerplate: using template haskell for efficient generic programming
TLDR
This paper presents a generic-programming system for Haskell that provides both the concision of other generic-Programming systems and the efficiency of handwritten code, and uses Template Haskell to generate efficient, non-generic code that outperforms existing generic- programming systems for Haskell.
Process-Oriented Patterns for Concurrent Software Engineering
TLDR
The patterns described in this thesis are drawn from a variety of existing process-oriented real-world applications, and have been used to construct new applications in fields such as embedded systems, multimedia processing, and complex systems simulation.
...
...

References

SHOWING 1-10 OF 23 REFERENCES
Scrap your boilerplate: a practical design pattern for generic programming
TLDR
This work describes a design pattern for writing programs that traverse data structures built from rich mutually-recursive data types that makes essential use of rank-2 polymorphism, an extension found in some implementations of Haskell.
Comparing libraries for generic programming in haskell
TLDR
To compare and characterise the many generic programming libraries in atyped functional language, a set of criteria is introduced and a generic programming benchmark is developed: aset of characteristic examples testing various facets of datatype-generic programming.
Typed Combinators for Generic Traversal
TLDR
This work introduces emph{functional strategies: typeful generic functions that not only can be applied to terms of any type, but which also allow generic traversal into subterms.
Uniform boilerplate and list processing
TLDR
The motivating observation for this paper is that most traversals have value-specific behaviour for just one type, and a new library exploiting this assumption is presented, which allows concise expression of traversals with competitive performance.
Template meta-programming for Haskell
TLDR
A new extension to the purely functional programming language Haskell that supports compile-time meta-programming and the ability to generate code at compile time allows the programmer to implement such features as polytypic programs, macro-like expansion, user directed optimization, and the generation of supporting data structures and functions from existing data structure and functions.
Comparing Approaches to Generic Programming in Haskell
TLDR
In these lecture notes, the various approaches to datatype-generic programming in Haskell are compared by means of example, and they are evaluated along different dimensions (expressivity, ease of use, and so on).
Scrap Your Boilerplate
TLDR
Generic programming is the umbrella term to describe a wide variety of programming technology directed at this problem, which aim to provide mechanical support for the “boilerplate” part, leaving the programmer free to concentrate on the important part of the algorithm.
A nanopass infrastructure for compiler education
TLDR
This paper describes the methodology and tools comprising the nanopass framework, which has developed a methodology and associated tools that simplify the task of building compilers composed of many fine-grained passes.
RepLib: a library for derivable type classes
TLDR
RepLib is presented, a GHC library that enables a similar mechanism for arbitrary type classes to be enabled, and supports the definition of operations defined by parameterized types.
Extensible and modular generics for the masses
TLDR
A revised version of Hinze’s Generics for the masses approach is presented, which shows that writing an extensible and modular generic programming library in Haskell 98 is possible and can be extended with ad-hoc behaviour for new data types.
...
...