Abstract
Generic programming libraries such as Scrap Your Boilerplate eliminate the need to write repetitive code, but typically introduce significant performance overheads.
This leaves programmers with the regrettable choice between writing succinct but slow programs and writing tedious but efficient programs.
Applying structured multi-stage programming techniques transforms Scrap Your Boilerplate from an inefficient library into a typed optimising code generator, bringing its performance in line with hand-written code, and so combining high-level programming with uncompromised performance.
- Michael D. Adams, Andrew Farmer, and José Pedro Magalhães. 2014. Optimizing SYB is Easy!. In Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation (PEPM ’14). ACM, New York, NY, USA, 71–82. Google Scholar
Digital Library
- Michael D. Adams, Andrew Farmer, and José Pedro Magalhães. 2015. Optimizing SYB traversals is easy! Science of Computer Programming 112, Part 2 (2015), 170 – 193. Google Scholar
Digital Library
- Vincent Balat, Roberto Di Cosmo, and Marcelo Fiore. 2004. Extensional Normalisation and Type-directed Partial Evaluation for Typed Lambda Calculus with Sums. In POPL ’04. ACM, New York, NY, USA, 64–76. Google Scholar
Digital Library
- Andrej Bauer and Matija Pretnar. 2012. Programming with Algebraic Effects and Handlers. CoRR abs/1203.1539 (2012). http://arxiv.org/abs/1203.1539Google Scholar
- Anders Bondorf. 1992. Improving Binding Times Without Explicit CPS-conversion. In Proceedings of the 1992 ACM Conference on LISP and Functional Programming (LFP ’92). ACM, New York, NY, USA, 1–10. Google Scholar
Digital Library
- Dmitri Boulytchev and Sergey Mechtaev. 2011. Efficiently scrapping boilerplate code in OCaml. (September 2011). ACM Workshop on ML 2011.Google Scholar
- 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 Scholar
Digital Library
- Olivier Danvy, Karoline Malmkjær, and Jens Palsberg. 1995. The essence of eta-expansion in partial evaluation. LISP and Symbolic Computation 8, 3 (1995), 209–227. Google Scholar
Digital Library
- Olivier Danvy, Karoline Malmkjær, and Jens Palsberg. 1996. Eta-expansion Does The Trick. ACM Trans. Program. Lang. Syst. 18, 6 (Nov. 1996), 730–751. Google Scholar
Digital Library
- Stephen Dolan, Leo White, KC Sivaramakrishnan, Jeremy Yallop, and Anil Madhavapeddy. 2015. Effective Concurrency through Algebraic Effects. (September 2015). OCaml Users and Developers Workshop 2015.Google Scholar
- Andrew Farmer, Andy Gill, Ed Komp, and Neil Sculthorpe. 2012. The HERMIT in the Machine: A Plugin for the Interactive Transformation of GHC Core Language Programs. In Proceedings of the 2012 Haskell Symposium (Haskell ’12). ACM, New York, NY, USA, 1–12. Google Scholar
Digital Library
- Andrzej Filinski. 2001. Normalization by Evaluation for the Computational Lambda-calculus (TLCA’01). Springer-Verlag, Berlin, Heidelberg, 151–165. http://dl.acm.org/citation.cfm?id=1754621.1754638Google Scholar
- Christopher S. Hardin and Roshan P. James. 2013. Core bench: micro-benchmarking for OCaml. OCaml Users and Developers Workshop. (September 2013).Google Scholar
- John Hughes. 1999. A Type Specialisation Tutorial. Springer Berlin Heidelberg, Berlin, Heidelberg, 293–325. Google Scholar
Cross Ref
- Jun Inoue. 2014. Supercompilation via staging. In Fourth International Valentin Turchin Workshop on Metacomputation.Google Scholar
- Patricia Johann and Neil Ghani. 2008. Foundations for structured programming with GADTs (POPL 2008). ACM.Google Scholar
- Mark P. Jones. 1995. Dictionary-free Overloading by Partial Evaluation. Lisp Symb. Comput. 8, 3 (Sept. 1995), 229–248. Google Scholar
Digital Library
- 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 Scholar
- Manohar Jonnalagedda, Thierry Coppey, Sandro Stucki, Tiark Rompf, and Martin Odersky. 2014. Staged Parser Combinators for Efficient Data Processing. In Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications (OOPSLA ’14). ACM, New York, NY, USA, 637–653. Google Scholar
Digital 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 Scholar
Digital Library
- Yukiyoshi Kameyama, Oleg Kiselyov, and Chung-chieh Shan. 2011. Shifting the Stage: Staging with Delimited Control. J. Funct. Program. 21, 6 (Nov. 2011), 617–662. Google Scholar
Digital Library
- Yukiyoshi Kameyama, Oleg Kiselyov, and Chung-chieh Shan. 2014. Combinators for Impure Yet Hygienic Code Generation. In Proceedings of the ACM SIGPLAN 2014 Workshop on Partial Evaluation and Program Manipulation (PEPM ’14). ACM, New York, NY, USA, 3–14. Google Scholar
Digital Library
- Andrew J. Kennedy. 2004. Functional Pearl: Pickler Combinators. Journal of Functional Programming 14, 6 (November 2004). Google Scholar
Digital Library
- Oleg Kiselyov. 2012. Delimited Control in OCaml, Abstractly and Concretely. Theor. Comput. Sci. 435 (June 2012), 56–76. Google Scholar
Digital Library
- Oleg Kiselyov. 2014. The Design and Implementation of BER MetaOCaml. In Functional and Logic Programming, Michael Codish and Eijiro Sumii (Eds.). Lecture Notes in Computer Science, Vol. 8475. Springer International Publishing, 86–102. Google Scholar
Cross Ref
- Oleg Kiselyov, Aggelos Biboudis, Nick Palladinos, and Yannis Smaragdakis. 2017. Stream Fusion, to Completeness. In POPL 2017. ACM. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Ralf Lämmel and Simon Peyton Jones. 2003. Scrap Your Boilerplate: A Practical Design Pattern for Generic Programming (TLDI ’03). ACM, New York, NY, USA, 26–37. Google Scholar
Digital Library
- Ralf Lämmel and Simon Peyton Jones. 2004. Scrap More Boilerplate: Reflection, Zips, and Generalised Casts. In Proceedings of the Ninth ACM SIGPLAN International Conference on Functional Programming (ICFP ’04). ACM, New York, NY, USA, 244–255. Google Scholar
Digital Library
- P. J. Landin. 1964. The Mechanical Evaluation of Expressions. Comput. J. 6, 4 (1964), 308–320. Google Scholar
Cross Ref
- J. Launchbury. 1991. Project Factorisations in Partial Evaluation. Cambridge University Press. https://books.google.co.uk/ books?id=B1UTK2j8rksCGoogle Scholar
- Julia L. Lawall and Olivier Danvy. 1994. Continuation-based Partial Evaluation. In Proceedings of the 1994 ACM Conference on LISP and Functional Programming (LFP ’94). ACM, New York, NY, USA, 227–238. Google Scholar
Digital Library
- Xavier Leroy. 2003. A proposal for recursive modules in Objective Caml. INRIA Rocquencourt. (May 2003). Version 1.1.Google Scholar
- Sam Lindley. 2007. Extensional Rewriting with Sums. In Proceedings of the 8th International Conference on Typed Lambda Calculi and Applications (TLCA’07). Springer-Verlag, Berlin, Heidelberg, 255–271. http://dl.acm.org/citation.cfm?id= 1770203.1770222Google Scholar
Digital Library
- Andres Löh and Ralf Hinze. 2006. Open Data Types and Open Functions. In Proceedings of the 8th ACM SIGPLAN International Conference on Principles and Practice of Declarative Programming (PPDP ’06). ACM, New York, NY, USA, 133–144. Google Scholar
Digital Library
- José Pedro Magalhães. 2013. Optimisation of Generic Programs through Inlining. In Accepted for publication at the 24th Symposium on Implementation and Application of Functional Languages (IFL’12) (IFL ’12). Google Scholar
Cross Ref
- Sergey Mechtaev. 2011. Eliminating boilerplate code in Objective Caml programs. System Programming 6, 1 (2011). In Russian.Google Scholar
- Kristian Nielsen and Morten Heine Sørensen. 1995. Call-By-Name CPS-Translation As a Binding-Time Improvement. In Proceedings of the Second International Symposium on Static Analysis (SAS ’95). Springer-Verlag, London, UK, UK, 296–313. http://dl.acm.org/citation.cfm?id=647163.717677 Google Scholar
Cross Ref
- 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
- Simon Peyton Jones and Simon Marlow. 2002. Secrets of the Glasgow Haskell Compiler Inliner. J. Funct. Program. 12, 5 (July 2002), 393–434.Google Scholar
- Tiark Rompf and Martin Odersky. 2010. Lightweight Modular Staging: A Pragmatic Approach to Runtime Code Generation and Compiled DSLs. In Proceedings of the Ninth International Conference on Generative Programming and Component Engineering (GPCE ’10). ACM, New York, NY, USA, 127–136. Google Scholar
Digital 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 Mohamed Taha. 1999. Multistage Programming: Its Theory and Applications. Ph.D. Dissertation. Oregon Graduate Institute of Science and Technology. AAI9949870.Google Scholar
- The GHC Team. 2015. The Glorious Glasgow Haskell Compilation System User’s Guide (7.10.2 ed.).Google Scholar
- Peter Thiemann. 2013. Partially Static Operations (PEPM ’13). ACM, New York, NY, USA, 75–76. Google Scholar
Digital Library
- Todd L. Veldhuizen. 2004. Active Libraries and Universal Languages. Ph.D. Dissertation. Indiana University Computer Science.Google Scholar
- Leo White, Frédéric Bour, and Jeremy Yallop. 2015. Modular Implicits. ACM Workshop on ML 2014 post-proceedings. (September 2015). Google Scholar
Cross Ref
- Jeremy Yallop. 2007. Practical Generic Programming in OCaml. In ACM SIGPLAN Workshop on ML, Derek Dreyer (Ed.). Freiburg, Germany. Google Scholar
Digital Library
- Jeremy Yallop. 2016. Staging Generic Programming. In Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM ’16). ACM, New York, NY, USA, 85–96. Google Scholar
Digital Library
Index Terms
Staged generic programming
Recommendations
Staged abstract interpreters: fast and modular whole-program analysis via meta-programming
It is well known that a staged interpreter is a compiler: specializing an interpreter to a given program produces an equivalent executable that runs faster. This connection is known as the first Futamura projection. It is even more widely known that an ...
Staging generic programming
PEPM '16: Proceedings of the 2016 ACM SIGPLAN Workshop on Partial Evaluation and Program ManipulationGeneric programming libraries such as Scrap Your Boilerplate eliminate the need to write repetitive code, but typically introduce significant performance overheads. This leaves programmers with the unfortunate choice of writing succinct but slow ...
First-class isomorphic specialization by staged evaluation
WGP '14: Proceedings of the 10th ACM SIGPLAN workshop on Generic programmingThe state of the art approach for reducing complexity in software development is to use abstraction mechanisms of programming languages such as modules, types, higher-order functions etc. and develop high-level frameworks and domain-specific ...






Comments