skip to main content
research-article

Folding domain-specific languages: deep and shallow embeddings (functional Pearl)

Published:19 August 2014Publication History
Skip Abstract Section

Abstract

A domain-specific language can be implemented by embedding within a general-purpose host language. This embedding may be deep or shallow, depending on whether terms in the language construct syntactic or semantic representations. The deep and shallow styles are closely related, and intimately connected to folds; in this paper, we explore that connection.

References

  1. Robert Atkey, Sam Lindley, and Jeremy Yallop. Unembedding domain-specific languages. In Haskell Symposium, pages 37--48. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Lennart Augustsson. Making EDSLs fly. In TechMesh, London, December 2012. Video at http://vimeo.com/73223479.Google ScholarGoogle Scholar
  3. Richard S. Bird. The promotion and accumulation strategies in transformational programming. ACM Transactions on Programming Languages and Systems, 6(4):487--504, October 1984. Addendum in TOPLAS 7(3):490--492, July 1985. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Corrado Böhm and Alessandro Berarducci. Automatic synthesis of typed λ-programs on term algebras. Theoretical Computer Science, 39:135--154, 1985.Google ScholarGoogle ScholarCross RefCross Ref
  5. Richard Boulton. Personal communication, 10th February 2014.Google ScholarGoogle Scholar
  6. Richard Boulton, Andrew Gordon, Mike Gordon, John Harrison, John Herbert, and John Van Tassel. Experience with embedding hardware description languages in HOL. In Victoria Stavridou, Thomas F. Melham, and Raymond T. Boute, editors, IFIP TC10/WG 10.2 International Conference on Theorem Provers in Circuit Design: Theory, Practice and Experience, pages 129--156. North-Holland/Elsevier, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Richard P. Brent and Hsiang-Tsung Kung. The chip complexity of binary arithmetic. In Symposium on Theory of Computing, pages 190--200. ACM, 1980. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Jacques Carette, Oleg Kiselyov, and Chung-chieh Shan. Finally tagless, partially evaluated: Tagless staged interpreters for simpler typed languages. Journal of Functional Programming, 19(5):509--543, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Maarten M. Fokkinga. Tupling and mutumorphisms. The Squiggolist, 1(4):81--82, June 1990.Google ScholarGoogle Scholar
  10. Martin Fowler. Domain-Specific Languages. Addison-Wesley, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Jeremy Gibbons. Functional programming for domain-specific languages. In Viktória Zsók, editor, Central European Functional Programming Summer School, volume 8606 of Lecture Notes in Computer Science, pages 1--27. Springer, 2014. To appear.Google ScholarGoogle ScholarCross RefCross Ref
  12. Jeremy Gibbons and Geraint Jones. The under-appreciated unfold. In International Conference on Functional Programming, pages 273--279, Baltimore, Maryland, September 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Ralf Hinze. An algebra of scans. In Mathematics of Program Construction, volume 3125 of Lecture Notes in Computer Science, pages 186--210. Springer, 2004.Google ScholarGoogle ScholarCross RefCross Ref
  14. Ralf Hinze. Church numerals, twice! Journal of Functional Programming, 15(1), 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Ralf Hinze. Adjoint folds and unfolds: An extended study. Science of Computer Programming, 78(11):2108--2159, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Ralf Hinze, Nicolas Wu, and Jeremy Gibbons. Unifying structured recursion schemes. In International Conference on Functional Programming, pages 209--220, Boston, Massachusetts, September 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Zhenjiang Hu, Hideya Iwasaki, and Masato Takeichi. Formal derivation of efficient parallel programs by construction of list homomorphisms. ACM Transactions on Programming Languages and Systems, 19(3):444--461, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Paul Hudak. Building domain-specific embedded languages. ACM Computing Surveys, 28(4), 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Anne Kaldewaij. Programming: The Derivation of Algorithms. Prentice Hall, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Oleg Kiselyov. Typed tagless final interpreters. In Jeremy Gibbons, editor, Generic and Indexed Programming, volume 7470 of Lecture Notes in Computer Science, pages 130--174. Springer, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Oleg Kiselyov, Amr Sabry, and Cameron Swords. Extensible effects: An alternative to monad transformers. In Haskell Symposium, pages 59--70. ACM, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Shriram Krishnamurthi, Matthias Felleisen, and Daniel P. Friedman. Synthesizing object-oriented and functional design to promote re-use. In European Conference on Object-Oriented Programming, volume 1445 of Lecture Notes in Computer Science, pages 91--113. Springer, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Ehud Lamm. CUFP write-up. Blog post, http://lambda-the-ultimate.org/node/2572, December 2007.Google ScholarGoogle Scholar
  24. Ralf Lämmel, Joost Visser, and Jan Kort. Dealing with large bananas. In Johan Jeuring, editor, Workshop on Generic Programming, volume Technical Report UU-CS-2000-19. Universiteit Utrecht, 2000.Google ScholarGoogle Scholar
  25. John Reynolds. User-defined types and procedural data structures as complementary approaches to data abstraction. In Stephen A. Schuman, editor, New Directions in Algorithmic Languages, pages 157--168, 1975.Google ScholarGoogle Scholar
  26. Josef Svenningsson and Emil Axelsson. Combining deep and shallow embedding for embedded domain-specific languages. In Trends in Functional Programming 2012, volume 7829 of Lecture Notes in Computer Science, pages 21--36, 2013.Google ScholarGoogle Scholar
  27. Wouter Swierstra. Datatypes à la carte. Journal of Functional Programming, 18(4):423--436, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Philip Wadler. Theorems for free! In Functional Programming Languages and Computer Architecture, pages 347--359. ACM, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Philip Wadler. The expression problem. Java Genericity Mailing list, November 1998. http://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt.Google ScholarGoogle Scholar
  30. Philip Wadler and Stephen Blott. How to make ad-hoc polymorphism less ad hoc. In Principles of Programming Languages, pages 60--76. ACM, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Folding domain-specific languages: deep and shallow embeddings (functional Pearl)

        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

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!