Hostname: page-component-848d4c4894-jbqgn Total loading time: 0 Render date: 2024-06-24T22:56:17.888Z Has data issue: false hasContentIssue false

Notions of computation as monoids*

Published online by Cambridge University Press:  05 October 2017

EXEQUIEL RIVAS
Affiliation:
Centro Internacional Franco Argentino de Ciencias de la Información y de Sistemas, CONICET, Rosario, Santa Fe, Argentina FCEIA, Universidad Nacional de Rosario, Rosario, Santa Fe, Argentina (e-mails: rivas@cifasis-conicet.gov.ar, jaskelioff@cifasis-conicet.gov.ar)
MAURO JASKELIOFF
Affiliation:
Centro Internacional Franco Argentino de Ciencias de la Información y de Sistemas, CONICET, Rosario, Santa Fe, Argentina FCEIA, Universidad Nacional de Rosario, Rosario, Santa Fe, Argentina (e-mails: rivas@cifasis-conicet.gov.ar, jaskelioff@cifasis-conicet.gov.ar)
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.

There are different notions of computation, the most popular being monads, applicative functors, and arrows. In this article, we show that these three notions can be seen as instances of a unifying abstract concept: monoids in monoidal categories. We demonstrate that even when working at this high level of generality, one can obtain useful results. In particular, we give conditions under which one can obtain free monoids and Cayley representations at the level of monoidal categories, and we show that their concretisation results in useful constructions for monads, applicative functors, and arrows. Moreover, by taking advantage of the uniform presentation of the three notions of computation, we introduce a principled approach to the analysis of the relation between them.

Type
Articles
Copyright
Copyright © Cambridge University Press 2017 

Footnotes

*

This work was partially funded by the Agencia Nacional de Promoción Científica y Tecnológica (PICT 2009-15) and Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET).

References

Abbott, M., Altenkirch, T., & Ghani, N. (2003). Categories of containers. In Proceedings of the 6th International Conference on Foundations of Software Science and Computation Structures and Joint European Conference on Theory and Practice of Software, FOSSACS'03/ETAPS'03. Berlin, Heidelberg: Springer-Verlag, pp. 23–38.Google Scholar
Adámek, J., & Rosický, J. (1994) Locally Presentable and Accessible Categories. London Mathematical Society Lecture Notes, vol. 189. Cambridge University Press.Google Scholar
Altenkirch, T., Chapman, J. & Uustalu, T. (2010) Monads need not be endofunctors. In Foundations of Software Science and Computational Structures, Ong, L. (ed), Lecture Notes in Computer Science, vol. 6014. Berlin, Heidelberg: Springer, pp. 297311.Google Scholar
Asada, K. (2010) Arrows are strong monads. In Proceedings of the 3rd ACM SIGPLAN Workshop on Mathematically Structured Functional Programming, MSFP '10, Capretta, V. & Chapman, J. (eds). ACM, pp. 33–42.Google Scholar
Asada, K. & Hasuo, I. (2010) Categorifying computations into components via arrows as profunctors. Electron. Notes Theor. Comput. Sci. 264 (2), 2545.Google Scholar
Atkey, R. (2011) What is a categorical model of arrows? Electron. Notes Theor. Comput. Sci. 229 (5), 1937.Google Scholar
Bainbridge, E. S., Freyd, P. J., Scedrov, A. & Scott, P. J. (1990) Functorial polymorphism. Theor. Comput. Sci. 70 (1), 3564.CrossRefGoogle Scholar
Barr, M. & Wells, C. (1985) Toposes, Triples and Theories. Grundlehren der Mathematischen Wissenschaften, vol. 278. Springer-Verlag.Google Scholar
Bénabou, J. (1973) Les distributeurs: d'après le cours de questions spéciales de mathématique. Rapport (Université catholique de Louvain (1970-) Séminaire de mathématique pure). Institut de mathématique pure et appliquée, Université catholique de Louvain.Google Scholar
Bird, R., Gibbons, J., Mehner, S., Voigtländer, J. & Schrijvers, T. (2013) Understanding idiomatic traversals backwards and forwards. In Proceedings of the 2013 ACM SIGPLAN Symposium on Haskell, Haskell '13. ACM, pp. 25–36.Google Scholar
Capriotti, P. & Kaposi, A. (2014) Free applicative functors. Proceedings of the 5th Workshop on Mathematically Structured Functional Programming, Levy, P. & Krishnaswami, N. (eds), EPTCS, vol. 153, pp. 2–30.Google Scholar
Cayley, A. (1854) On the theory of groups as depending on the symbolic equation θ n = 1. Philos. Mag. 7 (42), 4047.Google Scholar
Danielsson, N. A., Hughes, J., Jansson, P. & Gibbons, J. (2006) Fast and loose reasoning is morally correct. In Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, Morrisett, J. G. & Jones, S. L. P. (eds). ACM, pp. 206–217.Google Scholar
Day, B. (1970) On closed categories of functors. In Reports of the Midwest Category Seminar IV. Lecture Notes in Mathematics, vol. 137. Berlin, Heidelberg: Springer, pp. 138.Google Scholar
Day, B. (1973) Note on monoidal localisation. Bull. Aust. Math. Soc. 8 (2), 116.Google Scholar
Day, B. J. & Kelly, G. M. (1969) Enriched functor categories. Reports of the Midwest Category Seminar III. Lecture Notes in Mathematics, vol. 106. Berlin, Heidelberg: Springer, pp. 178191.CrossRefGoogle Scholar
Day, B. J. & Lack, S. (2007) Limits of small functors. J. Pure Appl. Algebra 210 (3), 651663.Google Scholar
Dubuc, E. J. (1974) Free monoids. J. Algebra 29 (2), 208228.Google Scholar
Hackett, J. & Hutton, G. (2015) Programs for cheap! Proceedings of the 30th Annual ACM/IEEE Symposium on Logic in Computer Science. IEEE, pp. 115–126.Google Scholar
Hudak, P., Courtney, A., Nilsson, H. & Peterson, J. (2003) Arrows, robots, and functional reactive programming. In Summer School on Advanced Functional Programming 2002, Oxford University. Lecture Notes in Computer Science, vol. 2638. Springer-Verlag, pp. 159187.Google Scholar
Hughes, J. (1986) A novel representation of lists and its application to the function “reverse''. Inform. Process. Lett. 22 (3), 141144.CrossRefGoogle Scholar
Hughes, J. (2000) Generalising monads to arrows. Sci. Comput. Program. 37 (1-3), 67111.Google Scholar
Hutton, G., Jaskelioff, M. & Gill, A. (2010) Factorising folds for faster functions. J. Funct. Program. 20(Special Issue 3–4), 353373.Google Scholar
Jacobs, B., Heunen, C. & Hasuo, I. (2009) Categorical semantics for arrows. J. Funct. Program. 19 (3–4), 403438.Google Scholar
Jacobson, N. (2009) Basic Algebra I. Dover Publications.Google Scholar
Jaskelioff, M. (2009) Modular monad transformers. In Programming Languages and Systems: 18th European Symposium on Programming, Castagna, G. (ed), Lecture Notes in Computer Science, vol. 5502. Springer, pp. 6479.Google Scholar
Jaskelioff, M. & Moggi, E. (2010) Monad transformers as monoid transformers. Theor. Comput. Sci. 411 (51–52), 44414466.Google Scholar
Jaskelioff, M., & Rypacek, O. (2012) An investigation of the laws of traversals. In Proceedings of the 4th Workshop on Mathematically Structured Functional Programming, Chapman, J. & Levy, P. B. (eds), EPTCS, vol. 76, pp. 40–49.Google Scholar
Kelly, G. M. (1980) A unified treatment of transfinite constructions for free algebras, free monoids, colimits, associated sheaves, and so on. Bull. Aust. Math. Soc. 22 (01), 183.Google Scholar
Kelly, G. M. & Power, A. J. (1993) Adjunctions whose counits are coequalizers, and presentations of finitary enriched monads. J. Pure Appl. Algebra 89 (1–2), 163179.Google Scholar
Lack, S. (2010) Note on the construction of free monoids. Appl. Categ. Struct. 18 (1), 1729.Google Scholar
Li, P. & Zdancewic, S. (2010) Arrows for secure information flow. Theor. Comput. Sci. 411 (19), 19741994.Google Scholar
Lindley, S., Wadler, P. & Yallop, J. (2011) Idioms are oblivious, arrows are meticulous, monads are promiscuous. Electron. Notes Theor. Comput. Sci. 229 (5), 97117.Google Scholar
Mac Lane, S. (1971) Categories for the Working Mathematician, 2nd ed. Graduate Texts in Mathematics, vol. 5. Springer-Verlag, 1998.Google Scholar
McBride, C. & Paterson, R. (2008) Applicative programming with effects. J. Funct. Program. 18 (01), 113.Google Scholar
Moggi, E. (1989) Computational lambda-calculus and monads. In Proceedings of the 4th Annual Symposium on Logic in Computer Science. IEEE Computer Society, pp. 14–23.Google Scholar
Moggi, E. (1991) Notions of computation and monads. Inform. Comput. 93 (1), 5592.Google Scholar
Moggi, E. (1995) A semantics for evaluation logic. Fundam. Inform. 22 (1/2), 117152.Google Scholar
Pastro, C. & Street, R. (2008) Doubles for monoidal categories. Theory Appl. Categ. 21, 6175.Google Scholar
Paterson, R. (2012) Constructing applicative functors. In Mathematics of Program Construction, Gibbons, J. & Nogueira, P. (eds), Lecture Notes in Computer Science, vol. 7342. Berlin, Heidelberg: Springer, pp. 300323.Google Scholar
Peyton Jones, S. L., Vytiniotis, D., Weirich, S. & Washburn, G. (2006) Simple unification-based type inference for GADTs. In Proceedings of the 11th ACM SIGPLAN International Conference on Functional Programming, Reppy, J. H., & Lawall, J. L. (eds). ACM, pp. 50–61.Google Scholar
Reynolds, J. C. (1980) Using category theory to design implicit conversions and generic operators. In Semantics-Directed Compiler Generation, Jones, N. D. (ed), Lecture Notes in Computer Science, vol. 94. Springer, pp. 211258.Google Scholar
Rivas, E., Jaskelioff, M. & Schrijvers, T. (2015) From monoids to near-semirings: the essence of MonadPlus and alternative. In Proceedings of the 17th International Symposium on Principles and Practice of Declarative Programming, Falaschi, M. & Albert, E. (eds). ACM, pp. 196–207.Google Scholar
Swierstra, W. & Altenkirch, T. (2007) Beauty in the beast. In Proceedings of the ACM SIGPLAN Workshop on Haskell, Haskell '07, Keller, G. (ed). ACM, pp. 25–36.Google Scholar
Vizzotto, J., Altenkirch, T. & Sabry, A. (2006) Structuring quantum effects: Superoperators as arrows. Math. Struct. Comput. Sci. 16 (3), 453468.CrossRefGoogle Scholar
Voigtländer, J. (2008) Asymptotic improvement of computations over free monads. In Proceedings of the 9th International Conference on Mathematics of Program Construction, Audebaud, P. & Paulin-Mohring, C. (eds), Lecture Notes in Computer Science, vol. 5133. Springer-Verlag, pp. 388–403.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.