skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Functional

Partially-static data as free extension of algebras

Published:30 July 2018Publication History
Skip Abstract Section

Abstract

Partially-static data structures are a well-known technique for improving binding times. However, they are often defined in an ad-hoc manner, without a unifying framework to ensure full use of the equations associated with each operation.

We present a foundational view of partially-static data structures as free extensions of algebras for suitable equational theories, i.e. the coproduct of an algebra and a free algebra in the category of algebras and their homomorphisms. By precalculating these free extensions, we construct a high-level library of partially-static data representations for common algebraic structures. We demonstrate our library with common use-cases from the literature: string and list manipulation, linear algebra, and numerical simplification.

References

  1. Baris Aktemur, Yukiyoshi Kameyama, Oleg Kiselyov, and Chung-chieh Shan. 2013. Shonan Challenge for Generative Programming: Short Position Paper. In Proceedings of the ACM SIGPLAN 2013 Workshop on Partial Evaluation and Program Manipulation (PEPM ’13). ACM, New York, NY, USA, 147–154. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Kenichi Asai. 2009. On typing delimited continuations: three new solutions to the printf problem. Higher-Order and Symbolic Computation 22, 3 (01 Sep 2009), 275–291. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Andrej Bauer and Matija Pretnar. 2015. Programming with algebraic effects and handlers. J. Log. Algebr. Meth. Program. 84, 1 (2015), 108–123.Google ScholarGoogle ScholarCross RefCross Ref
  4. Jacques Carette and Oleg Kiselyov. 2005. Multi-stage Programming with Functors and Monads: Eliminating Abstraction Overhead from Generic Code. In Generative Programming and Component Engineering: 4th International Conference, GPCE 2005, Tallinn, Estonia, September 29 - October 1, 2005. Proceedings, Robert Glück and Michael Lowry (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 256–274. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Jacques Carette and Oleg Kiselyov. 2011a. Multi-stage programming with functors and monads: Eliminating abstraction overhead from generic code. Sci. Comput. Program. 76, 5 (2011), 349–375. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Jacques Carette and Oleg Kiselyov. 2011b. Multi-stage Programming with Functors and Monads: Eliminating Abstraction Overhead from Generic Code. Sci. Comput. Program. 76, 5 (May 2011), 349–375. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Jacques Carette, Oleg Kiselyov, and Chung-chieh Shan. 2009. Finally Tagless, Partially Evaluated: Tagless Staged Interpreters for Simpler Typed Languages. J. Funct. Program. 19, 5 (Sept. 2009), 509–543. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Manuel M. T. Chakravarty, Gabriele Keller, Simon L. Peyton Jones, and Simon Marlow. 2005. Associated types with class. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2005, Long Beach, California, USA, January 12-14, 2005. 1–13. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Olivier Danvy. 1998. Functional Unparsing. J. Funct. Program. 8, 6 (Nov. 1998), 621–625. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Robert Glück and Jesper Jørgensen. 1997. An Automatic Program Generator for Multi-Level Specialization. LISP and Symbolic Computation 10, 2 (01 Jul 1997), 113–158. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Robert Glück, Ryo Nakashige, and Robert Zöchling. 1996. Binding-time analysis applied to mathematical algorithms. In System Modelling and Optimization: Proceedings of the Seventeenth IFIP TC7 Conference on System Modelling and Optimization, 1995, Jaroslav Doležal and Jiří Fidler (Eds.). Springer US, Boston, MA, 137–146.Google ScholarGoogle ScholarCross RefCross Ref
  12. John Hughes. 1999. A Type Specialisation Tutorial. Springer Berlin Heidelberg, Berlin, Heidelberg, 293–325. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Jun Inoue. 2014. Supercompilation via staging. In Fourth International Valentin Turchin Workshop on Metacomputation.Google ScholarGoogle Scholar
  14. Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. 1993. Partial Evaluation and Automatic Program Generation. Prentice-Hall, Inc., Upper Saddle River, NJ, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. David Kaloper-Meršinjak and Jeremy Yallop. 2016. Generic Partially-static Data (Extended Abstract). In Proceedings of the 1st International Workshop on Type-Driven Development (TyDe 2016). ACM, New York, NY, USA, 39–40. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Oleg Kiselyov. 2014. The Design and Implementation of BER MetaOCaml. In Functional and Logic Programming (Lecture Notes in Computer Science), Michael Codish and Eijiro Sumii (Eds.), Vol. 8475. Springer International Publishing, 86–102.Google ScholarGoogle Scholar
  17. Oleg Kiselyov, Kedar N. Swadi, and Walid Taha. 2004. A Methodology for Generating Verified Combinatorial Circuits. In Proceedings of the 4th ACM International Conference on Embedded Software (EMSOFT ’04). ACM, New York, NY, USA, 249–258. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Torben Ægidius Mogensen. 1988. Partially Static Structures in a Self-Applicable Partial Evaluator. In Partial Evaluation and Mixed Computation, D. Bjørner, A.P. Ershov, and N.D. Jones (Eds.).Google ScholarGoogle Scholar
  19. Simon Peyton Jones. 2016. Template Haskell, 14 years on. Talk given at the International Summer School on Metaprogramming, Cambridge, UK. (August 2016). https://www.cl.cam.ac.uk/events/metaprog2016/Template-Haskell-Aug16.pptx .Google ScholarGoogle Scholar
  20. Tiark Rompf. 2016. The Essence of Multi-stage Evaluation in LMS. Springer International Publishing, Cham, 318–335.Google ScholarGoogle Scholar
  21. Tiark Rompf, Arvind K. Sujeeth, Nada Amin, Kevin J. Brown, Vojin Jovanovic, HyoukJoong Lee, Manohar Jonnalagedda, Kunle Olukotun, and Martin Odersky. 2013. Optimizing Data Structures in High-level Programs: New Directions for Extensible Compilers Based on Staging. In Proceedings of the 40th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’13). ACM, New York, NY, USA, 497–510. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Tim Sheard and Iavor S. Diatchki. 2002. Staging Algebraic Datatypes. Unpublished manuscript. (2002). http://web.cecs.pdx.edu/~sheard/papers/stagedData.ps .Google ScholarGoogle Scholar
  23. Walid Taha. 2003. A Gentle Introduction to Multi-stage Programming.. In Domain-Specific Program Generation (Lecture Notes in Computer Science), Christian Lengauer, Don S. Batory, Charles Consel, and Martin Odersky (Eds.), Vol. 3016. Springer, 30–50.Google ScholarGoogle Scholar
  24. Walid Taha and Tim Sheard. 1997. Multi-stage Programming with Explicit Annotations. In Proceedings of the 1997 ACM SIGPLAN Symposium on Partial Evaluation and Semantics-based Program Manipulation (PEPM ’97). ACM, New York, NY, USA, 203–217. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Peter Thiemann. 2013. Partially Static Operations (PEPM ’13). ACM, New York, NY, USA, 75–76. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Jeremy Yallop. 2017. Staged Generic Programming. Proc. ACM Program. Lang. 1, ICFP, Article 29 (Aug. 2017), 29:1–29:29 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Jeremy Yallop and Leo White. 2015. Modular Macros. (September 2015). OCaml Users and Developers Workshop 2015.Google ScholarGoogle Scholar

Index Terms

  1. Partially-static data as free extension of algebras

          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