Skip to main content

Preprocessing Eden with Template Haskell

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 3676))

Abstract

Extending a programming language by new language constructs often implies extending its compiler by additional machinery. To reduce the complex interweaving of compiler and extension implementations we present a simple and modular concept of lifting the often needed additional preprocessing out of the base compiler implementation. Avoiding the introduction of standalone tools, this preprocessor framework for extensions of Haskell is designed as a separate portable library of monadic preprocessing functions based on Template Haskell. Additional preprocessing passes expressed in this framework can then much easier be carried along the series of ever advancing base compiler versions. Taking Eden, a parallel programming extension of Haskell, as an example we show that besides achieving improved portability and reusability pass code sizes can be reduced considerably.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Peyton Jones, S., et al.: Haskell 1998: A Non-strict, Purely Functional Language (2003), See: http://www.haskell.org/definition

  2. Czarnecki, K., et al.: Generative Programming and Active Libraries. In: Jazayeri, M., Musser, D.R., Loos, R.G.K. (eds.) Dagstuhl Seminar 1998. LNCS, vol. 1766, p. 25. Springer, Heidelberg (2000)

    Chapter  Google Scholar 

  3. Loogen, R., Ortega-Mallén, Y., Peña, R.: Parallel Functional Programming in Eden. Journal of Functional Programming, Special Issue on Functional Approaches to High-Performance Parallel Programming (2004) (to appear)

    Google Scholar 

  4. Peyton Jones, S., et al.: The Glorious Glasgow Haskell Compilation System, Version 6.4 (2005), Available at: http://www.haskell.org/ghc

  5. Berthold, J., Klusik, U., Loogen, R., Priebe, S., Weskamp, N.: High-level Process Control in Eden. In: Kosch, H., Böszörményi, L., Hellwagner, H. (eds.) Euro-Par 2003. LNCS, vol. 2790, pp. 732–741. Springer, Heidelberg (2003)

    Chapter  Google Scholar 

  6. Berthold, J.: Towards a generalised runtime environment for parallel haskells. In: Bubak, M., van Albada, G.D., Sloot, P.M.A., Dongarra, J. (eds.) ICCS 2004. LNCS, vol. 3038, pp. 297–305. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  7. Nordin, T., Peyton Jones, S.L.: Green card: a foreign-language interface for Haskell. In: Proceedings of the Haskell Workshop, Amsterdam, Netherlands (1997)

    Google Scholar 

  8. Reid, A.: Template Greencard. In: Proceedings of 15th International Workshop on the Implementation of Functional Languages (IFL 2003), Edinburgh (2003)

    Google Scholar 

  9. Sheard, T., Peyton Jones, S.: Template Meta-programming for Haskell. In: Haskell Workshop 2002. ACM Press, New York (2002)

    Google Scholar 

  10. Wadler, P.: Comprehending monads. In: Mathematical Structures in Computer Science, vol. 2, pp. 461–493 (1992)

    Google Scholar 

  11. Jones, M.P.: Functional Programming with Overloading and Higher-Order Polymorphism. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 97–136. Springer, Heidelberg (1995)

    Google Scholar 

  12. Klusik, U., Loogen, R., Priebe, S.: Controlling Parallelism and Data Distribution in Eden. In: Trends in Functional Programming (Selected papers of the Second Scottish Functional Programming Workshop), Intellect, vol. 2, pp. 53–64 (2000)

    Google Scholar 

  13. Trinder, P.W., Hammond, K., Loidl, H.W., Peyton Jones, S.L.: Algorithm + Strategy = Parallelism. In: Kluge, W. (ed.) Workshop on the Implementation of Functional Languages, Bonn, Germany, Universität Kiel (1996)

    Google Scholar 

  14. Backhouse, R., Jansson, P., Jeuring, J., Meertens, L.: Generic Programming – An Introduction. In: Swierstra, S.D., Henriques, P.R., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 28–115. Springer, Heidelberg (1999)

    Chapter  Google Scholar 

  15. Lynagh, I.: Template Haskell: A report from the field. Unpublished. Available from the author’s web page (2003)

    Google Scholar 

  16. Lynagh, I.: Unrolling and simplifying expressions with Template Haskell. Unpublished. Available from the author’s web page (2003)

    Google Scholar 

  17. Seefried, S., Chakravarty, M., Keller, G.: Optimising Embedded DSLs using Template Haskell. In: Karsai, G., Visser, E. (eds.) GPCE 2004. LNCS, vol. 3286, pp. 186–205. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  18. Peyton Jones, S., Tolmach, A., Hoare, T.: Playing by the Rules: Rewriting as a practical optimisation technique in GHC. In: Haskell Workshop (2001)

    Google Scholar 

  19. Tolmach, A., et al.: An External Representation for the GHC Core Language (Draft for GHC 5.02 documentation) (2001)

    Google Scholar 

  20. Veldhuizen, T., Gannon, D.: Active libraries: Rethinking the roles of compilers and libraries. In: Proceedings of the SIAM Workshop on Object Oriented Methods for Interoperable Scientific and Engineering Computing, OO 1998 (1998)

    Google Scholar 

  21. Norell, U., Jansson, P.: Prototyping Generic Programming in Template Haskell. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 314–333. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  22. Lämmel, R., Peyton Jones, S.: Scrap your Boilerplate: A Practical Design Pattern for Generic Programming. In: Proceedings of ACM Sigplan Types in Language Design and Implementation, TLDI (2003)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2005 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Priebe, S. (2005). Preprocessing Eden with Template Haskell. In: Glück, R., Lowry, M. (eds) Generative Programming and Component Engineering. GPCE 2005. Lecture Notes in Computer Science, vol 3676. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11561347_24

Download citation

  • DOI: https://doi.org/10.1007/11561347_24

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-29138-1

  • Online ISBN: 978-3-540-31977-1

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics