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.
- A. Alexandrescu. Modern C++ design. Addison Wesley, 2001.Google Scholar
- A. Bawden. First-class macros have types. In 27th ACM Symposium on Principles of Programming Languages (POPL '00), pages 133-141, Boston, Jan. 2000. ACM. Google ScholarDigital Library
- C. Calcagno, W. Taha, L. Huang, and X. Leroy. A bytecodecompiled, type-safe, multi-stage language. Technical report, Computer Science Department, Yale University, 2002.Google Scholar
- W. Clinger and J. Rees. Macros that work. In 19th ACM Symposium on Principles of Programming Languages (POPL '91), pages 155-162. ACM, Jan. 1991. Google ScholarDigital Library
- O. Danvy. Functional unparsing. Journal of Functional Programming, 8, Nov. 1998. Google ScholarDigital Library
- J. de Wit. A technical overview of Generic Haskell. Master's thesis, INF-SCR-02-03, Department of Information and Computing Sciences, Utrecht University, 2002.Google Scholar
- K. Dybvig, R. Hieb, and C. Bruggeman. Syntactic abstraction in Scheme. Lisp and Symbolic Computation, 5:295-326, 1993. Google ScholarDigital Library
- S. E. Ganz, A. Sabry, and W. Taha. Macros as multi-stage computations: Type-safe, generative, binding macros in MacroML. In Proceedings of the ACM SIGPLAN International Conference on Functional Programming (ICFP-2001), New York, September 2001. ACM Press. Google ScholarDigital Library
- R. Hinze and S. Peyton Jones. Derivable type classes. In G. Hutton, editor, Proceedings of the 2000 Haskell Workshop, Montreal, number NOTTCS-TR-00-1 in Technical Reports, Sept. 2000.Google Scholar
- E. Kohlbecker, D. Friedman, M. Felleisen, and B. Duba. Hygienic macro expansion. In ACM Symposium on Lisp and Functional Programming, pages 151-161. ACM, 1986. Google ScholarDigital Library
- K. Pitman. Special forms in Lisp. In ACM Symposium on Lisp and Functional Programming, pages 179-187. ACM, 1980. Google ScholarDigital Library
- A. D. Robinson. Impact of economics on compiler optimization. In Proceedings of the ACM 2001 Java Grande Conference, Stanford, pages 1-10. ACM, June 2001. Google ScholarDigital Library
- T. Sheard. Accomplishments and research challenges in meta-programming. In W. Taha, editor, Proceedings of the Workshop on Semantics, Applications and Implementation of Program Generation (SAIG '01), volume 2196 of LNCS, pages 2-44, Berlin, September 2001. Springer Verlag. Invited talk. Google Scholar
- T. Sheard, Z. Benaissa, and M. Martel. Introduction to Multistage Programming Using MetaML. Pacific Software Research Center, Oregon Graduate Institute, 2nd edition, 2000. Available at http://cse.ogi.edu/~sheard/papers/manual.ps.Google Scholar
- M. Shields, T. Sheard, and S. L. Peyton Jones. Dynamic typing by staged type inference. In 25th ACM Symposium on Principles of Programming Languages (POPL '98), pages 289-302, San Diego, Jan. 1998. ACM. Google ScholarDigital Library
- W. Taha and T. Sheard. Multi-stage programming with explicit annotations. In ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM '97), volume 32 of SIGPLAN Notices, pages 203-217. ACM, Amsterdam, June 1997. Google ScholarDigital Library
- N. Winstanley. A type-sensitive preprocessor for Haskell. In Glasgow Workshop on Functional Programming, Ullapool, 1997.Google Scholar
Index Terms
Template meta-programming for Haskell
Recommendations
Template meta-programming for Haskell
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 ...
Camlp4 and Template Haskell
CUFP '10: ACM SIGPLAN Commercial Users of Functional Programming"Static metaprogramming" is compile-time code analysis and synthesis. It has many applications, such as (from simple to complex): defining abbreviations, generating boilerplate from type definitions, extending the language syntax, and embedding DSLs.
...
An EDSL approach to high performance Haskell programming
Haskell '13This paper argues for a new methodology for writing high performance Haskell programs by using Embedded Domain Specific Languages.
We exemplify the methodology by describing a complete library, meta-repa, which is a reimplementation of parts of the repa ...
Comments