To: seminaire@pauillac.inria.fr From: Didier.Remy@inria.fr Subject: SEM - INRIA : Cristal - 19/12/02 - Paris - FR Vous pouvez maintenant vous abonner à nos annonces de séminaires http://pauillac.inria.fr/seminaires/subscribe.html S E M I N A I R E . ___ / _ _ / _ / / / \ / \ / / __| / |___ |_/ |_/ / |__ |_/ |_ ___ . / / ___ __ /_ _ / _/ /| /| _ __ __ _ _ / / / /_ / __| / / |/ | / \ /_ / / \ | / __| |___ / / __/ |_ |_/ |_ / | |_/__/ |_ |_/ |/ |_/ I N R I A - Rocquencourt Salle de conference du Bat 11 Jeudi 19 decembre, 10h30 ------------------ Simon Peyton Jones ------------------ Microsoft Research ==================================== Template meta-programming in Haskell ==================================== The C++ template mechanism is a strange, baroque functional language embedded in the type system of C++. Despite its high barrier to entry it is quite widely used, which is strong evidence that the ability to generate a program, rather than simply write one, is useful. Surely it should be possible to address the same goal in a more principled way! In this talk I'll expose to your critical gaze a design for template meta-programming in Haskell. It picks up on recent work on staged programming (notably MetaML) but focuses on compile-time execution, rather than run-time code generation. Unlike MetaML, though, one can generate new top-level declarations which is crucial for many applications. Template Haskell allows the usual (hygienic) quote and anti-quote, but I'll show why traditional quotation is not enough. So Template Haskell exposes quotation as a simple monad, and provides access to the monadic layer when quotation fails; this monadic explanation of the magic of quotation is, we believe, new. Template Haskell also supports simple reification, so one can pattern-match on types and code as well as constructing them. Template Haskell is implemented in GHC, but none of the design is Haskell-specific: the same plan would work for ML, with minor qualifications. This is joint work with Tim Sheard, from OGI. The paper is at http://research.microsoft.com/~simonpj/papers/meta-haskell