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

A principled approach to ornamentation in ML

Published:27 December 2017Publication History
Skip Abstract Section

Abstract

Ornaments are a way to describe changes in datatype definitions reorganizing, adding, or dropping some pieces of data so that functions operating on the bare definition can be partially and sometimes totally lifted into functions operating on the ornamented structure. We propose an extension of ML with higher-order ornaments, demonstrate its expressiveness with a few typical examples, including code refactoring, study the metatheoretical properties of ornaments, and describe their elaboration process. We formalize ornamentation via an a posteriori abstraction of the bare code, returning a generic term, which lives in a meta-language above ML. The lifted code is obtained by application of the generic term to well-chosen arguments, followed by staged reduction, and some remaining simplifications. We use logical relations to closely relate the lifted code to the bare code.

Skip Supplemental Material Section

Supplemental Material

ornamentationinml.webm

References

  1. Jean-Philippe Bernardy and Moulin Guilhem. 2013. Type-theory in color. In International Conference on Functional Programming. 61–72. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Pierre Chambard and Grégoire Henry. 2012. Experiments in generic programming: runtime type representation and implicit values. Presentation at the OCaml Users and Developers meeting, Copenhagen, Denmark. (sep 2012). http: //oud.ocaml.org/2012/slides/oud2012- paper4- slides.pdfGoogle ScholarGoogle Scholar
  3. Pierre-Évariste Dagand and Conor McBride. 2013. A Categorical Treatment of Ornaments. In 28th Annual ACM/IEEE Symposium on Logic in Computer Science, LICS 2013, New Orleans, LA, USA, June 25-28, 2013. IEEE Computer Society, 530–539. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Pierre-Évariste Dagand and Conor McBride. 2014. Transporting functions across ornaments. J. Funct. Program. 24, 2-3 (2014), 316–383. Google ScholarGoogle ScholarCross RefCross Ref
  5. Dominique Devriese and Frank Piessens. 2011. On the Bright Side of Type Classes: Instance Arguments in Agda. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming (ICFP ’11). 143–155. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. J. Nathan Foster, Michael B. Greenwald, Jonathan T. Moore, Benjamin C. Pierce, and Alan Schmitt. 2007. Combinators for bidirectional tree transformations: A linguistic approach to the view-update problem. ACM Transactions on Programming Languages and Systems 29, 3 (May 2007), 17. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Oleg Kiselyov. 2014. The Design and Implementation of BER MetaOCaml. Springer International Publishing, Cham, 86–102. Google ScholarGoogle ScholarCross RefCross Ref
  8. Hsiang-Shang Ko. 2014. Analysis and synthesis of inductive families. DPhil dissertation. University of Oxford.Google ScholarGoogle Scholar
  9. Hsiang-Shang Ko and Jeremy Gibbons. 2013. Modularising inductive families. Progress in Informatics 10 (2013). Google ScholarGoogle ScholarCross RefCross Ref
  10. Hsiang-Shang Ko and Jeremy Gibbons. 2016. Programming with ornaments. Journal of Functional Programming 27 (2016). Google ScholarGoogle ScholarCross RefCross Ref
  11. Conor McBride. 2011. Ornamental Algebras, Algebraic Ornaments. (2011). https://personal.cis.strath.ac.uk/conor.mcbride/ pub/OAAO/LitOrn.pdfGoogle ScholarGoogle Scholar
  12. Trevor L. McDonell, Timothy A. K. Zakian, Matteo Cimini, and Ryan R. Newton. 2016. Ghostbuster: A Tool for Simplifying and Converting GADTs. In Proceedings of the 21st ACM SIGPLAN International Conference on Functional Programming (ICFP 2016). ACM, New York, NY, USA, 338–350. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Shayan Najd and Simon Peyton-Jones. 2016. Trees that grow. JUCS (2016). https://www.microsoft.com/en- us/research/ wp- content/uploads/2016/11/trees- that- grow- 2.pdfGoogle ScholarGoogle Scholar
  14. Chris Okasaki. 1998. Views for Standard ML. In In SIGPLAN Workshop on ML. 14–23.Google ScholarGoogle Scholar
  15. Scala. 2017. Implicit Parameters. Scala documentation. (2017). https://docs.scala- lang.org/tour/implicit- parameters.htmlGoogle ScholarGoogle Scholar
  16. Dimitrios Vytiniotis, Simon Peyton Jones, and Tom Schrijvers. 2010. Let Should Not Be Generalised, In Proceedings of the 5th ACM SIGPLAN Workshop on Types in Language Design and Implementation. https://www.microsoft.com/en- us/ research/publication/let- should- not- be- generalised/Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Philip Wadler. 1986. Views: A way for pattern matching to cohabit with data abstraction. (1986).Google ScholarGoogle Scholar
  18. Leo White, Frédéric Bour, and Jeremy Yallop. 2014. Modular implicits. In Proceedings ML Family/OCaml Users and Developers workshops, ML/OCaml 2014, Gothenburg, Sweden, September 4-5, 2014. 22–63. Google ScholarGoogle ScholarCross RefCross Ref
  19. Thomas Williams, Pierre-Évariste Dagand, and Didier Rémy. 2014. Ornaments in practice. In Proceedings of the 10th ACM SIGPLAN workshop on Generic programming, WGP 2014, Gothenburg, Sweden, August 31, 2014, José Pedro Magalhães and Tiark Rompf (Eds.). ACM, 15–24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Thomas Williams and Didier Rémy. 2017. A Principled Approach to Ornamentation in ML. Research Report RR-9117. Inria. https://hal.inria.fr/hal- 01628060Google ScholarGoogle Scholar

Index Terms

  1. A principled approach to ornamentation in ML

            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!