Template Haskell papers

This is a list of all the papers on Template Haskell of which I am aware in approximately chronological order. For each paper is a local copy, to try to avoid dead links, along with its BiBTeX entry; you can also get the latest BiBTeX entries for all papers in a single file.

If you have written a paper on Template Haskell that isn't listed here then please let me know where I can find it along with a .bib file (please try to make it as complete as possible).


Template metaprogramming for Haskell

By Tim Sheard and Simon Peyton Jones, May 2002. [A4 ps] [bib]

Abstract

We propose a new extension to the purely functional programming language Haskell that supports compile-time meta-programming. The purpose of the system is to support the algorithmic construction of programs at compile-time.

The ability to generate code at compile time allows the programmer to implement such features as polytypic programs, macro-like expansion, user directed optimization (such as inlining), and the generation of supporting data structures and functions from existing data structures and functions.

Our design is being implemented in the Glasgow Haskell Compiler, ghc.


Template Haskell: A Report From The Field

By Ian Lynagh, May 2003. [A4 ps] [bib]

Abstract

We have now had a year since the introductory Template Haskell paper was written. In this report I look back upon what I have used it for in this time giving an idea of the ways in which I have found it useful and explaining the problems I have encountered with it.

In most cases there are existing tools that provide the functionality we can implement with Template Haskell. The advantages Template Haskell offers here are a single syntax and semantics to learn and it operates without a preprocessor phase which simplifies build systems.

Template Haskell is still young, so it is still lacking in functionality necessary for some applications. By highlighting what was needed most we hope to guide the direction of future development to give the best payoff.

There are some applications for which the current design is insufficient. The key problem is that type and strictness information is not available to applications, so safety conditions for some transformations on abstract syntax trees we may wish to do cannot be checked easily.


Unrolling and Simplifying Expressions with Template Haskell

By Ian Lynagh, May 2003. [A4 ps] [bib]

Abstract

We introduce a handful of modules for manipulating Template Haskell datastructures, building up to modules that allow simplification and recursion unrolling of Haskell code. To illustrate their use, and to demonstrate the performance improvements that motivate this work, we also discuss an example application Fraskell, showing how we can get more than an order of magnitude performance increase with minimal changes to the source.


Automatic skeletons in Template Haskell

By Kevin Hammond, Jost Berthold and Rita Loogen, June 2003. [A4 ps] [bib]

Abstract

This paper uses Template Haskell to automatically select appropriate skeleton implementations in the Eden parallel dialect of Haskell. The approach allows implementation parameters to be statically tuned according to architectural cost models based on source analyses. This permits us to target a range of parallel architecture classes from a single source specification. A major advantage of the approach is that cost models are user-definable and can be readily extended to new data or computation structures etc.


Optimising Embedded DSLs using Template Haskell

By Sean Seefried, Manuel Chakravarty, Gabriele Keller, March 2004. [A4 ps] [bib]

Abstract

Embedded domain specific languages (EDSLs) provide a specialised language for a particular application area while harnessing the infrastructure of an existing general purpose programming language. The reduction in implementation costs that results from this approach comes at a price: the EDSL often compiles to inefficient code since the host language's compiler only optimises at the level of host language constructs. The paper presents an approach to solving this problem based on compile-time meta-programming which retains the simplicity of the embedded approach. We use PanTHeon, our implementation of an existing EDSL for image synthesis to demonstrate the benefits and drawbacks of this approach. Furthermore, we suggest potential improvements to Template Haskell, the meta-programming framework we are using, which would greatly improve its applicability to this kind of task.


Typing Template Haskell: Soft Types

By Ian Lynagh, August 2004. [A4 ps] [bib]

Abstract

In this paper we give the motivation for an improved type system for Template Haskell, a recent compile-time meta-programming extension for Haskell, and explain what properties we would like the type system to have and why. We then present a type system, based on soft types, for a simplified Template Haskell-like language that has these properties. We prove that it has principal types and describe an algorithm that implements type inference for this type system.


Back to the main page.

Valid XHTML 1.0!

Last updated 1 September 2004.

Ian Lynagh - <igloo@earth.li>