skip to main content
10.1145/581690.581691acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Template meta-programming for Haskell

Published:03 October 2002Publication History

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.

References

  1. A. Alexandrescu. Modern C++ design. Addison Wesley, 2001.Google ScholarGoogle Scholar
  2. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle Scholar
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. O. Danvy. Functional unparsing. Journal of Functional Programming, 8, Nov. 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle Scholar
  7. K. Dybvig, R. Hieb, and C. Bruggeman. Syntactic abstraction in Scheme. Lisp and Symbolic Computation, 5:295-326, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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 ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. K. Pitman. Special forms in Lisp. In ACM Symposium on Lisp and Functional Programming, pages 179-187. ACM, 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 ScholarGoogle Scholar
  14. 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 ScholarGoogle Scholar
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. N. Winstanley. A type-sensitive preprocessor for Haskell. In Glasgow Workshop on Functional Programming, Ullapool, 1997.Google ScholarGoogle Scholar

Index Terms

  1. Template meta-programming for Haskell

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      Haskell '02: Proceedings of the 2002 ACM SIGPLAN workshop on Haskell
      October 2002
      118 pages
      ISBN:1581136056
      DOI:10.1145/581690

      Copyright © 2002 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 3 October 2002

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • Article

      Acceptance Rates

      Haskell '02 Paper Acceptance Rate9of24submissions,38%Overall Acceptance Rate57of143submissions,40%

      Upcoming Conference

      ICFP '24

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader