Skip to main content
×
Home

Notions of computation as monoids*

  • EXEQUIEL RIVAS (a1) (a2) and MAURO JASKELIOFF (a1) (a2)
Abstract
Abstract

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.

Copyright
Footnotes
Hide All
*

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).

Footnotes
References
Hide All
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.
Adámek J., & Rosický J. (1994) Locally Presentable and Accessible Categories. London Mathematical Society Lecture Notes, vol. 189. Cambridge University Press.
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.
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.
Asada K. & Hasuo I. (2010) Categorifying computations into components via arrows as profunctors. Electron. Notes Theor. Comput. Sci. 264 (2), 2545.
Atkey R. (2011) What is a categorical model of arrows? Electron. Notes Theor. Comput. Sci. 229 (5), 1937.
Bainbridge E. S., Freyd P. J., Scedrov A. & Scott P. J. (1990) Functorial polymorphism. Theor. Comput. Sci. 70 (1), 3564.
Barr M. & Wells C. (1985) Toposes, Triples and Theories. Grundlehren der Mathematischen Wissenschaften, vol. 278. Springer-Verlag.
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.
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.
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.
Cayley A. (1854) On the theory of groups as depending on the symbolic equation θ n = 1. Philos. Mag. 7 (42), 4047.
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.
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.
Day B. (1973) Note on monoidal localisation. Bull. Aust. Math. Soc. 8 (2), 116.
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.
Day B. J. & Lack S. (2007) Limits of small functors. J. Pure Appl. Algebra 210 (3), 651663.
Dubuc E. J. (1974) Free monoids. J. Algebra 29 (2), 208228.
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.
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.
Hughes J. (1986) A novel representation of lists and its application to the function “reverse''. Inform. Process. Lett. 22 (3), 141144.
Hughes J. (2000) Generalising monads to arrows. Sci. Comput. Program. 37 (1-3), 67111.
Hutton G., Jaskelioff M. & Gill A. (2010) Factorising folds for faster functions. J. Funct. Program. 20(Special Issue 3–4), 353373.
Jacobs B., Heunen C. & Hasuo I. (2009) Categorical semantics for arrows. J. Funct. Program. 19 (3–4), 403438.
Jacobson N. (2009) Basic Algebra I. Dover Publications.
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.
Jaskelioff M. & Moggi E. (2010) Monad transformers as monoid transformers. Theor. Comput. Sci. 411 (51–52), 44414466.
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.
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.
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.
Lack S. (2010) Note on the construction of free monoids. Appl. Categ. Struct. 18 (1), 1729.
Li P. & Zdancewic S. (2010) Arrows for secure information flow. Theor. Comput. Sci. 411 (19), 19741994.
Lindley S., Wadler P. & Yallop J. (2011) Idioms are oblivious, arrows are meticulous, monads are promiscuous. Electron. Notes Theor. Comput. Sci. 229 (5), 97117.
Mac Lane S. (1971) Categories for the Working Mathematician, 2nd ed. Graduate Texts in Mathematics, vol. 5. Springer-Verlag, 1998.
McBride C. & Paterson R. (2008) Applicative programming with effects. J. Funct. Program. 18 (01), 113.
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.
Moggi E. (1991) Notions of computation and monads. Inform. Comput. 93 (1), 5592.
Moggi E. (1995) A semantics for evaluation logic. Fundam. Inform. 22 (1/2), 117152.
Pastro C. & Street R. (2008) Doubles for monoidal categories. Theory Appl. Categ. 21, 6175.
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.
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.
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.
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.
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.
Vizzotto J., Altenkirch T. & Sabry A. (2006) Structuring quantum effects: Superoperators as arrows. Math. Struct. Comput. Sci. 16 (3), 453468.
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.
Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 17 *
Loading metrics...

Abstract views

Total abstract views: 77 *
Loading metrics...

* Views captured on Cambridge Core between 5th October 2017 - 18th November 2017. This data will be updated every 24 hours.