skip to main content
10.1145/2628136.2628138acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

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

Published: 19 August 2014 Publication History

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.
[2]
Lennart Augustsson. Making EDSLs fly. In TechMesh, London, December 2012. Video at http://vimeo.com/73223479.
[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.
[4]
Corrado Böhm and Alessandro Berarducci. Automatic synthesis of typed λ-programs on term algebras. Theoretical Computer Science, 39:135--154, 1985.
[5]
Richard Boulton. Personal communication, 10th February 2014.
[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.
[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.
[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.
[9]
Maarten M. Fokkinga. Tupling and mutumorphisms. The Squiggolist, 1(4):81--82, June 1990.
[10]
Martin Fowler. Domain-Specific Languages. Addison-Wesley, 2011.
[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.
[12]
Jeremy Gibbons and Geraint Jones. The under-appreciated unfold. In International Conference on Functional Programming, pages 273--279, Baltimore, Maryland, September 1998.
[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.
[14]
Ralf Hinze. Church numerals, twice! Journal of Functional Programming, 15(1), 2005.
[15]
Ralf Hinze. Adjoint folds and unfolds: An extended study. Science of Computer Programming, 78(11):2108--2159, 2013.
[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.
[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.
[18]
Paul Hudak. Building domain-specific embedded languages. ACM Computing Surveys, 28(4), 1996.
[19]
Anne Kaldewaij. Programming: The Derivation of Algorithms. Prentice Hall, 1990.
[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.
[21]
Oleg Kiselyov, Amr Sabry, and Cameron Swords. Extensible effects: An alternative to monad transformers. In Haskell Symposium, pages 59--70. ACM, 2013.
[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.
[23]
Ehud Lamm. CUFP write-up. Blog post, http://lambda-the-ultimate.org/node/2572, December 2007.
[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.
[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.
[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.
[27]
Wouter Swierstra. Datatypes à la carte. Journal of Functional Programming, 18(4):423--436, 2008.
[28]
Philip Wadler. Theorems for free! In Functional Programming Languages and Computer Architecture, pages 347--359. ACM, 1989.
[29]
Philip Wadler. The expression problem. Java Genericity Mailing list, November 1998. http://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt.
[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.

Cited By

View all
  • (2024)Semantics Lifting for Syntactic SugarProceedings of the ACM on Programming Languages10.1145/36897588:OOPSLA2(1336-1361)Online publication date: 8-Oct-2024
  • (2024)Compiled, Extensible, Multi-language DSLs (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746278:ICFP(64-87)Online publication date: 15-Aug-2024
  • (2024)Challenges for Non-Classical Reasoning in Contemporary AI ApplicationsKI - Künstliche Intelligenz10.1007/s13218-024-00855-838:1-2(7-16)Online publication date: 4-Jul-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '14: Proceedings of the 19th ACM SIGPLAN international conference on Functional programming
August 2014
390 pages
ISBN:9781450328739
DOI:10.1145/2628136
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 19 August 2014

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. deep and shallow embedding
  2. domain-specific languages
  3. folds

Qualifiers

  • Research-article

Funding Sources

Conference

ICFP'14
Sponsor:

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)47
  • Downloads (Last 6 weeks)6
Reflects downloads up to 13 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Semantics Lifting for Syntactic SugarProceedings of the ACM on Programming Languages10.1145/36897588:OOPSLA2(1336-1361)Online publication date: 8-Oct-2024
  • (2024)Compiled, Extensible, Multi-language DSLs (Functional Pearl)Proceedings of the ACM on Programming Languages10.1145/36746278:ICFP(64-87)Online publication date: 15-Aug-2024
  • (2024)Challenges for Non-Classical Reasoning in Contemporary AI ApplicationsKI - Künstliche Intelligenz10.1007/s13218-024-00855-838:1-2(7-16)Online publication date: 4-Jul-2024
  • (2024)Reactamole: functional reactive molecular programmingNatural Computing10.1007/s11047-024-09982-523:3(477-495)Online publication date: 19-Apr-2024
  • (2024)Declarative Pearl: Rigged ContractsFunctional and Logic Programming10.1007/978-981-97-2300-3_6(99-114)Online publication date: 15-May-2024
  • (2023)Extensible Embedded Hardware Description Languages with Compilation, Simulation and VerificationProceedings of the 13th International Symposium on Highly Efficient Accelerators and Reconfigurable Technologies10.1145/3597031.3597051(1-10)Online publication date: 14-Jun-2023
  • (2023)Compiling Parallel Symbolic Execution with Continuations2023 IEEE/ACM 45th International Conference on Software Engineering (ICSE)10.1109/ICSE48619.2023.00116(1316-1328)Online publication date: May-2023
  • (2023)Forward- or Reverse-Mode Automatic Differentiation: What's the Difference?Science of Computer Programming10.1016/j.scico.2023.103010(103010)Online publication date: Aug-2023
  • (2023)Flexible Automation of Quantified Multi-Modal Logics with InteractionsKI 2023: Advances in Artificial Intelligence10.1007/978-3-031-42608-7_18(215-230)Online publication date: 18-Sep-2023
  • (2023)Solving Modal Logic Problems by Translation to Higher-Order LogicLogic and Argumentation10.1007/978-3-031-40875-5_3(25-43)Online publication date: 2-Aug-2023
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media