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.
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- Andrej Bauer and Matija Pretnar. 2015. Programming with algebraic effects and handlers. J. Log. Algebr. Meth. Program. 84, 1 (2015), 108–123.Google ScholarCross Ref
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- Olivier Danvy. 1998. Functional Unparsing. J. Funct. Program. 8, 6 (Nov. 1998), 621–625. Google ScholarDigital Library
- 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 ScholarDigital Library
- 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 ScholarCross Ref
- John Hughes. 1999. A Type Specialisation Tutorial. Springer Berlin Heidelberg, Berlin, Heidelberg, 293–325. Google ScholarDigital Library
- Jun Inoue. 2014. Supercompilation via staging. In Fourth International Valentin Turchin Workshop on Metacomputation.Google Scholar
- 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 ScholarDigital Library
- 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 ScholarDigital Library
- 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 Scholar
- 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 ScholarDigital Library
- 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 Scholar
- 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 Scholar
- Tiark Rompf. 2016. The Essence of Multi-stage Evaluation in LMS. Springer International Publishing, Cham, 318–335.Google Scholar
- 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 ScholarDigital Library
- Tim Sheard and Iavor S. Diatchki. 2002. Staging Algebraic Datatypes. Unpublished manuscript. (2002). http://web.cecs.pdx.edu/~sheard/papers/stagedData.ps .Google Scholar
- 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 Scholar
- 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 ScholarDigital Library
- Peter Thiemann. 2013. Partially Static Operations (PEPM ’13). ACM, New York, NY, USA, 75–76. Google ScholarDigital Library
- Jeremy Yallop. 2017. Staged Generic Programming. Proc. ACM Program. Lang. 1, ICFP, Article 29 (Aug. 2017), 29:1–29:29 pages. Google ScholarDigital Library
- Jeremy Yallop and Leo White. 2015. Modular Macros. (September 2015). OCaml Users and Developers Workshop 2015.Google Scholar
Index Terms
- Partially-static data as free extension of algebras
Recommendations
Free Heyting algebras: revisited
CALCO'09: Proceedings of the 3rd international conference on Algebra and coalgebra in computer scienceWe use coalgebraic methods to describe finitely generated free Heyting algebras. Heyting algebras are axiomatized by rank 0-1 axioms. In the process of constructing free Heyting algebras we first apply existing methods to weak Heyting algebras--the rank ...
L‐fuzzy congruence classes in universal algebras
AbstractIn this paper, we study fuzzy congruence relations and their classes; so‐called fuzzy congruence classes in universal algebras whose truth values are in a complete lattice satisfying the infinite meet distributive law. Fuzzy congruence relations ...
Algebras with fuzzy equalities
An algebra with fuzzy equality is a set with operations on it that is equipped with similarity ~, i.e. a fuzzy equivalence relation, such that each operation f is compatible with ~. Described verbally, compatibility says that each f yields similar ...
Comments