Hostname: page-component-76fb5796d-9pm4c Total loading time: 0 Render date: 2024-04-26T15:57:29.824Z Has data issue: false hasContentIssue false

Programming with ornaments

Published online by Cambridge University Press:  12 December 2016

HSIANG-SHANG KO
Affiliation:
Information Systems Architecture Research Division, National Institute of Informatics, Japan (e-mail: hsiang-shang@nii.ac.jp)
JEREMY GIBBONS
Affiliation:
Department of Computer Science, University of Oxford, UK (e-mail: jeremy.gibbons@cs.ox.ac.uk)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

Dependently typed programming advocates the use of various indexed versions of the same shape of data, but the formal relationship amongst these structurally similar datatypes usually needs to be established manually and tediously. Ornaments have been proposed as a formal mechanism to manage the relationships between such datatype variants. In this paper, we conduct a case study under an ornament framework; the case study concerns programming binomial heaps and their operations — including insertion and minimum extraction — by viewing them as lifted versions of binary numbers and numeric operations. We show how current dependently typed programming technology can lead to a clean treatment of the binomial heap constraints when implementing heap operations. We also identify some gaps between the current technology and an ideal dependently typed programming language that we would wish to have for our development.

Type
Articles
Copyright
Copyright © Cambridge University Press 2016 

References

Bernardy, J.-P. & Moulin, G. (2013) Type theory in color. In Proceedings of International Conference on Functional Programming, Uustalu, Tarmo (ed), ICFP'13. New York, NY, USA: ACM, pp. 6172.Google Scholar
Bove, A. & Dybjer, P. (2009) Dependent types at work. In Language Engineering and Rigorous Software Development, Ana Bove, Luís Soares Barbosa, Alberto Pardo, and Jorge Sousa Pinto (eds), Lecture Notes in Computer Science, vol. 5520. Berlin, Germany: Springer-Verlag, pp. 5799.CrossRefGoogle Scholar
Brady, E., McBride, C. & McKinna, J. (2004) Inductive families need not store their indices. In Types for Proofs and Programs, Berardi, Stefano, Coppo, Mario, and Damiani, Ferruccio (eds), Lecture Notes in Computer Science, vol. 3085. Berlin, Germany: Springer-Verlag, pp. 115129.Google Scholar
Chapman, J., Dagand, P.-É., McBride, C. & Morris, P. (2010) The gentle art of levitation. In Proceedings of International Conference on Functional Programming, Stephanie Weirich (ed), ICFP'10. New York, NY, USA: ACM, pp. 3–14.Google Scholar
Cockx, J., Devriese, D. & Piessens, F. (2014) Pattern matching without K. In International Conference on Functional Programming, Chakravarty, Manuel M.T. (ed), ICFP'14. New York, NY, USA: ACM, pp. 257–268.Google Scholar
Czarnecki, K., Foster, J. N., Hu, Z., Lämmel, R., Schürr, A. & Terwilliger, J. F. (2009) Bidirectional transformations: A cross-discipline perspective. In Proceedings of International Conference on Model Transformation, Paige, Richard F. (ed), Lecture Notes in Computer Science, vol. 5563. Berlin, Germany: Springer-Verlag, pp. 260–283.CrossRefGoogle Scholar
Dagand, P.-É. & McBride, C. (2013) Elaborating Inductive Definitions. In Journées Francophones des Langages Applicatifs, JFLA'13. Rocquencourt, France: INRIA.Google Scholar
Dagand, P.-É. & McBride, C. (2014) Transporting functions across ornaments. J. Funct. Program. 24 (2–3), 316383.CrossRefGoogle Scholar
Devriese, D. & Piessens, F. (2011) On the bright side of type classes: Instance arguments in Agda. In Proceedings of International Conference on Functional Programming, Olivier Danvy (ed), ICFP'11. New York, NY, USA: ACM, pp. 143–155.CrossRefGoogle Scholar
Dybjer, P. (1994) Inductive families. Form. Asp. Comput. 6 (4), 440465.Google Scholar
Goguen, H., McBride, C. & McKinna, J. (2006) Eliminating dependent pattern matching. In Algebra, Meaning, and Computation, Futatsugi, Kokichi, Jouannaud, Jean-Pierre, and Meseguer, José, (eds), Lecture Notes in Computer Science, vol. 4060. Berlin, Germany: Springer-Verlag, pp. 521–540.Google Scholar
Ko, H.-S. (2014) Analysis and Synthesis of Inductive Families. DPhil Thesis, University of Oxford.Google Scholar
Ko, H.-S. & Gibbons, J. (2013a) Modularising inductive families. Prog. Informat. 10, 6588.Google Scholar
Ko, H.-S. & Gibbons, J. (2013b) Relational algebraic ornaments. In Dependently Typed Programming, Weirich, Stephanie (ed), DTP'13. New York, NY, USA: ACM, pp. 3748.Google Scholar
Kopylov, A. (2003) Dependent intersection: A new way of defining records in type theory. In Logic in Computer Science, Kolaitis, Phokion G. (ed), LICS'03. Washington, DC, USA: IEEE, pp. 8695.Google Scholar
Martin-Löf, P. (1984) Intuitionistic Type Theory. Bibliopolis, Napoli.Google Scholar
McBride, C. (2011) Ornamental Algebras, Algebraic Ornaments. Unpublished manuscript.Google Scholar
McBride, C. (2014) How to keep your neighbours in order. In Proceedings of International Conference on Functional Programming, Chakravarty, Manuel M.T. (ed), ICFP'14. New York, NY, USA: ACM, pp. 297–309.CrossRefGoogle Scholar
McBride, C. & McKinna, J. (2004) The view from the left. J. Funct. Program. 14 (1), 69111.CrossRefGoogle Scholar
Norell, U. (2007) Towards a Practical Programming Language Based on Dependent Type Theory. PhD Thesis, Chalmers University of Technology.Google Scholar
Norell, U. (2009) Dependently typed programming in Agda. In Advanced Functional Programming, Koopman, Pieter, Plasmeijer, Rinus, and Swierstra, Doaitse (eds), Lecture Notes in Computer Science, vol. 5832. Berlin, Germany: Springer-Verlag, pp. 230266.CrossRefGoogle Scholar
Okasaki, C. (1999) Purely Functional Data Structures. Cambridge University Press.Google Scholar
Sheard, T. & Linger, N. (2007) Programming in Ωmega. In Central European Functional Programming School, Horváth, Zoltán, Plasmeijer, Rinus, Soós, Anna, and Zsók, Viktória (eds), Lecture Notes in Computer Science, vol. 5161. Berlin, Germany: Springer-Verlag, pp. 158227.Google Scholar
Williams, T., Dagand, P.-É. & Rémy, D. (2014) Ornaments in practice. In Workshop on Generic Programming, Magalhäes, José Pedro and Rompf, Tiark (eds), WGP'14. New York, NY, USA: ACM, pp. 1524.Google Scholar
Supplementary material: File

Ko and Gibbons supplementary material

Ko and Gibbons supplementary material 1

Download Ko and Gibbons supplementary material(File)
File 9.4 KB
Submit a response

Discussions

No Discussions have been published for this article.