Abstract
Algebraic data types and catamorphisms (folds) play a central role in functional programming as they allow programmers to define recursive data structures and operations on them uniformly by structural recursion. Likewise, in object-oriented (OO) programming, recursive hierarchies of object types with virtual methods play a central role for the same reason. There is a semantical correspondence between these two situations which we reveal and formalize categorically. To this end, we assume a coalgebraic model of OO programming with functional objects. The development may be helpful in deriving refactorings that turn sufficiently disciplined functional programs into OO programs of a designated shape and vice versa.
See http://www.uni-koblenz.de/~laemmel/expression/ (the paper’s web site) for an extended version.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Awodey, S.: Category Theory. Clarendon Press (2006)
Beck, J.: Distributive laws. Lecture Notes in Mathematics 80, 119–140 (1969)
Bierman, G.M., Meijer, E., Torgersen, M.: Lost in translation: formalizing proposed extensions to C#. In: OOPSLA 2007: Proceedings of the 22nd annual ACM SIGPLAN conference on Object oriented programming systems and applications, pp. 479–498. ACM Press, New York (2007)
Birka, A., Ernst, M.D.: A practical type system and language for reference immutability. In: OOPSLA 2004: Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pp. 35–49. ACM Press, New York (2004)
Chin, W.-N.: Towards an automated tupling strategy. In: PEPM 1993: Proceedings of the 1993 ACM SIGPLAN symposium on Partial evaluation and semantics-based program manipulation, pp. 119–132. ACM Press, New York (1993)
Clarke, D.G., Potter, J.M., Noble, J.: Ownership types for flexible alias protection. In: OOPSLA 1998: Proceedings of the 13th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pp. 48–64. ACM Press, New York (1998)
Fiore, M., Plotkin, G., Turi, D.: Abstract Syntax and Variable Binding. In: LICS 1999: Proceedings of the 14th Annual IEEE Symposium on Logic in Computer Science, pp. 193–202. IEEE Press, Los Alamitos (1999)
Fisher, K., Reppy, J.: Object-oriented aspects of Moby. Technical report, University of Chicago Computer Science Department Technical Report (TR-2003-10) (July 2003)
Fokkinga, M.M.: Tupling and Mutumorphisms. Appeared in: The Squigollist 1(4), 81–82 (1990)
Gamma, E., Helm, R., Johnson, R., Vlissides, J.: Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading (1994)
Hu, Z., Iwasaki, H., Takeichi, M.: Deriving structural hylomorphisms from recursive definitions. In: ICFP 1996: Proceedings of the first ACM SIGPLAN international conference on Functional programming, pp. 73–82. ACM Press, New York (1996)
Hu, Z., Iwasaki, H., Takeichi, M., Takano, A.: Tupling calculation eliminates multiple data traversals. In: ICFP 1997: Proceedings of the second ACM SIGPLAN international conference on Functional programming, pp. 164–175. ACM Press, New York (1997)
Jacobs, B.: Distributive laws for the coinductive solution of recursive equations. Information and Computation 204(4), 561–587 (2006)
Jacobs, B.P.F.: Objects and classes, coalgebraically. In: Freitag, B., Jones, C.B., Lengauer, C., Schek, H.J. (eds.) Object-Orientation with Parallelism and Persistence, pp. 83–103. Kluwer Academic Publishers, Dordrecht (1996)
Kabanov, J., Vene, V.: Recursion Schemes for Dynamic Programming. In: Uustalu, T. (ed.) MPC 2006. LNCS, vol. 4014, pp. 235–252. Springer, Heidelberg (2006)
Klin, B.: Adding recursive constructs to bialgebraic semantics. Journal of Logic and Algebraic Programming 60-61, 259–286 (2004)
Launchbury, J., Sheard, T.: Warm fusion: deriving build-catas from recursive definitions. In: FPCA 1995: Proceedings of the seventh international conference on Functional programming languages and computer architecture, pp. 314–323. ACM Press, New York (1995)
Meertens, L.G.L.T.: Paramorphisms. Formal Aspects of Computing 4(5), 413–424 (1992)
Meijer, E., Fokkinga, M.M., Paterson, R.: Functional Programming with Bananas, Lenses, Envelopes and Barbed Wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991)
Odersky, M.: The Scala Language Specification, Version 2.6, DRAFT, Programming Methods Laboratory, EPFL, Switzerland (December 19, 2007)
Pierce, B.C., Turner, D.N.: Simple type-theoretic foundations for object-oriented programming. Journal of Functional Programming 4(2), 207–247 (1994)
Reichel, H.: An approach to object semantics based on terminal co-algebras. Mathematical Structures in Computer Science 5(2), 129–152 (1995)
Rémy, D.: Programming Objects with ML-ART: An extension to ML with Abstract and Record Types. In: Hagiya, M., Mitchell, J.C. (eds.) TACS 1994. LNCS, vol. 789, pp. 321–346. Springer, Heidelberg (1994)
Turi, D.: Functorial Operational Semantics and its Denotational Dual. PhD thesis, Free University, Amsterdam (June 1996)
Turi, D., Plotkin, G.D.: Towards a mathematical operational semantics. In: Proceedings 12th Annual IEEE Symposium on Logic in Computer Science, LICS 1997, Warsaw, Poland, 29 June – 2 July 1997, pp. 280–291. IEEE Press, Los Alamitos (1997)
Uustalu, T., Vene, V., Pardo, A.: Recursion schemes from comonads. Nordic Journal of Computing 8(3), 366–390 (2001)
Vene, V., Uustalu, T.: Functional programming with apomorphisms (corecursion). Proceedings of the Estonian Academy of Sciences: Physics, Mathematics 47(3), 147–161 (1998)
Wadler, P.: The expression problem. Message to java-genericity electronic mailing list (November 1998), http://www.daimi.au.dk/~madst/tool/papers/expression.txt
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2008 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Lämmel, R., Rypacek, O. (2008). The Expression Lemma. In: Audebaud, P., Paulin-Mohring, C. (eds) Mathematics of Program Construction. MPC 2008. Lecture Notes in Computer Science, vol 5133. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-70594-9_12
Download citation
DOI: https://doi.org/10.1007/978-3-540-70594-9_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-70593-2
Online ISBN: 978-3-540-70594-9
eBook Packages: Computer ScienceComputer Science (R0)