skip to main content
research-article
Open Access

Strict and lazy semantics for effects: layering monads and comonads

Published:30 July 2018Publication History
Skip Abstract Section

Abstract

Two particularly important classes of effects are those that can be given semantics using a monad and those that can be given semantics using a comonad. Currently, programs with both kinds of effects are usually given semantics using a technique that relies on a distributive law. While it is known that not every pair of a monad and a comonad has a distributive law, it was previously unknown if there were any realistic pairs of effects that could not be given semantics in this manner. This paper answers that question by giving an example of a pair of effects that cannot be given semantics using a distributive law. Our example furthermore is intimately tied to the duality of strictness and laziness. We discuss how to view this duality through the lens of effects.

Skip Supplemental Material Section

Supplemental Material

a88-hirsch.webm

References

  1. Samson Abramsky. 1994. Proofs as Processes . Theoretical Computer Science 135, 1 (1994), 5–9. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Jean-Marc Andreoli. 1992. Logic Programming with Focusing Proofs in Linear Logic . Journal of Logic and Computation 2 (1992), 297–347.Google ScholarGoogle ScholarCross RefCross Ref
  3. Zena M. Ariola, Matthias Felleisen, John Maraist, Martin Odersky, and Philip Wadler. 1995. A Call-By-Need Lambda Calculus . In POPL. ACM, New York, NY, USA, 233–246. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Robert Atkey. 2009. Parameterised Notions of Computation . Journal of Functional Programming 19, 3-4 (2009), 335–376. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Emmanuel Beffara. 2006. A Concurrent Model for Linear Logic . ENTCS 155 (2006), 147–168. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. G. Bellin and P. J. Scott. 1994. On the π -Calculus and Linear Logic . Theoretical Computer Science 135, 1 (1994), 11–65. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Jean Bénabou. 1963. Catégories avec Multiplication . Comptes Rendus de l’Académie des Sciences Paris 258 (1963), 771–774.Google ScholarGoogle Scholar
  8. Stephen Brookes and Shai Geva. 1992. Computational Comonads and Intensional Semantics . In Applications of Categories in Computer Science. Cambridge University Press, Cambridge, UK, 1–44.Google ScholarGoogle Scholar
  9. Stephen Brookes and Kathryn van Stone. 1993. Monads and Comonads in Intensional Semantics . Technical Report CMU-CS-93-140. Carnegie Mellon University Department of Computer Science. Google ScholarGoogle Scholar
  10. Aloïs Brunel, Marco Gaboardi, Damiano Mazza, and Steve Zdancewic. 2014. A Core Quantitative Coeffect Calculus . In Programming Languages and Systems. Springer Berlin Heidelberg, Berlin, Heidelberg, 351–370. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Alonzo Church and J. B. Rosser. 1936. Some Properties of Conversion . Trans. Amer. Math. Soc. 39, 3 (1936), 472–482.Google ScholarGoogle ScholarCross RefCross Ref
  12. Pierre-Louis Curien, Marcelo Fiore, and Guillaume Munch-Maccagnoni. 2016. A Theory of Effects and Resources: Adjunction Models and Polarised Calculi . In POPL. ACM, New York, NY, USA, 44–56. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Pierre-Louis Curien and Hugo Herbelin. 2000. The Duality of Computation . In ICFP. ACM, New York, NY, USA, 233–243. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Vincent Danos, Jean-Baptiste Joinet, and Harold Schellinx. 1997. A New Deconstructive Logic: Linear Logic . The Journal of Symbol Logic 62, 3 (1997), 755–807.Google ScholarGoogle ScholarCross RefCross Ref
  15. Henry DeYoung, Luís Caires, Frank Pfenning, and Bernardo Toninho. 2012. Cut Reduction in Linear Logic as Asynchronous Session-Typed Communication . In CSL, Vol. 16. Schloss Dagstuhl–Leibniz-Zentrum fuer Informatik, Dagstuhl, Germany, 228–242.Google ScholarGoogle Scholar
  16. Jeff Egger, Rasmus Ejlers Møgelberg, and Alex Simpson. 2014. The Enriched Effect Calculus: Syntax and Semantics . Journal of Logic and Computation 24, 3 (2014), 615–654.Google ScholarGoogle ScholarCross RefCross Ref
  17. Andrzej Filinski. 1999. Representing Layered Monads . In POPL. ACM, New York, NY, USA, 175–188. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Andrzej Filinski. 2010. Monads in Action . In POPL. ACM, New York, NY, USA, 483–494. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Marco Gaboardi, Shin-ya Katsumata, Dominic Orchard, Flavien Breuvart, and Tarmo Uustalu. 2016. Combining Effects and Coeffects via Grading . In ICFP. ACM, New York, NY, USA, 476–489. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Gerhard Gentzen. 1934. Untersuchungen über das logische Schließen I . Mathematische Zeitschrift 39 (1934), 176–210.Google ScholarGoogle ScholarCross RefCross Ref
  21. Gerhard Gentzen. 1935. Untersuchungen über das logische Schließen II . Mathematische Zeitschrift 39 (1935), 405–431.Google ScholarGoogle ScholarCross RefCross Ref
  22. Jean-Yves Girard. 1987. Linear Logic . Theoretical Computer Science 50, 1 (1987), 1–101. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Jean-Yves Girard. 1991. A New Constructive Logic: Classical Logic . Research Report RR-1443. INRIA.Google ScholarGoogle Scholar
  24. Michael Hicks, Gavin Bierman, Nataliya Guts, Daan Leijen, and Nikhil Swamy. 2014. Polymonadic Programming . EPTCS 153 (2014), 79–99.Google ScholarGoogle ScholarCross RefCross Ref
  25. Andrew K. Hirsch and Ross Tate. 2018. Strict and Lazy Semantics for Effects: Layering Monads and Comonads . In ICFP. ACM, New York, NY, USA, Technical Report.Google ScholarGoogle Scholar
  26. Martin Hyland, Gordon Plotkin, and John Power. 2006. Combining Effects: Sum and Tensor . Theoretical Computer Science 357, 1 (2006), 70–99. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Joachim Lambek. 1969. Deductive Systems and Categories II. Standard Constructions and Closed Categories . In Category Theory, Homology Theory and Their Applications I. Springer Berlin Heidelberg, Berlin, Heidelberg, 76–122.Google ScholarGoogle Scholar
  28. Tom Leinster. 1998. General Operads and Multicategories . (1998).Google ScholarGoogle Scholar
  29. Paul Blain Levy. 1999. Call-By-Push-Value: A Subsuming Paradigm . In Typed Lambda Calculus and Applications. Springer Berlin Heidelberg, Berlin, Heidelberg, 228–243. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Paul Blain Levy. 2001. Call-By-Push-Value . Ph.D. Dissertation. Queen Mary and Westfield College University of London, London, UK.Google ScholarGoogle Scholar
  31. Francisco J. López-Fraguas, Juan Rodríguez-Hortalá, and Jaime Sánchez-Hernández. 2007. A Simple Rewrite Notion for Call-time Choice Semantics . In PPDP. ACM, New York, NY, USA, 197–208. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. John M. Lucassen and David K. Gifford. 1988. Polymorphic Effect Systems . In POPL. ACM, New York, NY, USA, 47–57. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Christoph Lüth and Neil Ghani. 2002. Composing Monads using Coproducts . In ICFP. ACM, New York, NY, USA, 133–144. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Saunders Mac Lane. 1963. Natural Associativiy and Commutativity . Rice University Studies 49, 4 (1963), 28–46.Google ScholarGoogle Scholar
  35. John Maraist, Martin Odersky, David N. Turner, and Philip Wadler. 1995. Call-by-Name, Call-by-Value, Call-by-Need, and the Linear Lambda Calculus . ENTCS 1 (1995), 370–392.Google ScholarGoogle ScholarCross RefCross Ref
  36. Daniel Marino and Todd Millstein. 2009. A Generic Type-and-Effect System . In TLDI. ACM, New York, NY, USA, 39–50. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Robin Milner, Joachim Parrow, and David Walker. 1992. A Calculus of Mobile Processes, I . Information and Computation 100, 1 (1992), 1–40. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. Eugenio Moggi. 1989. Computational Lambda-Calculus and Monads . In LICS. IEEE, Piscataway Township, NJ, USA, 14–23. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Flemming Nielson. 1996. Annotated Type and Effect Systems . Comput. Surveys 28, 2 (1996), 344–345. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Flemming Nielson and Hanne Riis Nielson. 1999. Type and Effect Systems . In Correct System Design: Recent Insights and Advances. Springer Berlin Heidelberg, Berlin, Heidelberg, 114–136. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Michel Parigot. 1992a. Free Deduction: An Analysis of “Computations” in Classical Logic . In Logic Programming. Springer Berlin Heidelberg, Berlin, Heidelberg, 361–380. Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Michel Parigot. 1992b. λµ-Calculus: An Algorithmic Interpretation of Classical Natural Deduction . In Logic Programming and Automated Reasoning. Springer Berlin Heidelberg, Berlin, Heidelberg, 190–201. Google ScholarGoogle ScholarDigital LibraryDigital Library
  43. Tomas Petricek, Dominic Orchard, and Alan Mycroft. 2013. Coeffects: Unified Static Analysis of Context-Dependence . In ICALP. Springer-Verlag, Berlin, Heidelberg, 385–397. Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Tomas Petricek, Dominic Orchard, and Alan Mycroft. 2014. Coeffects: A Calculus of Context-Dependent Computation . In ICFP. ACM, New York, NY, USA, 123–135. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Simon L. Peyton Jones and Philip Wadler. 1993. Imperative Functional Programming . In POPL. ACM, New York, NY, USA, 71–84. Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. G. D. Plotkin. 1975. Call-By-Name, Call-By-Value, and the λ-Calculus . Theoretical Computer Science 1, 2 (1975), 125–159.Google ScholarGoogle ScholarCross RefCross Ref
  47. John Power and Hiroshi Watanabe. 2002. Combining a Monad and a Comonad . Theoretical Computer Science 280, 1 (2002), 137–162. Google ScholarGoogle ScholarDigital LibraryDigital Library
  48. Amr Sabry and Philip Wadler. 1996. A Reflection on Call-by-Value . In ICFP. ACM, New York, NY, USA, 13–24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  49. Harold Schellinx. 1994. The Noble Art of Linear Decorating . Ph.D. Dissertation. Unerversiteit van Amsterdam, Amsterdam, Netherlands.Google ScholarGoogle Scholar
  50. M. E. Szabo. 1975. Polycategories . Communications in Algebra 3, 8 (1975), 663–689.Google ScholarGoogle ScholarCross RefCross Ref
  51. Ross Tate. 2013. The Sequential Semantics of Producer Effect Systems . In POPL. ACM, New York, NY, USA, 15–26. Google ScholarGoogle ScholarDigital LibraryDigital Library
  52. Tarmu Uustalu and Varmo Vene. 2005. Signals and Comonads . Journal of Universal Computer Science 11, 7 (2005), 1310–1326.Google ScholarGoogle Scholar
  53. Tarmo Uustalu and Varmo Vene. 2008. Comonadic Notions of Computation . ENTCS 203, 5 (2008), 263–284. Google ScholarGoogle ScholarDigital LibraryDigital Library
  54. Philip Wadler. 1990. Linear Types Can Change the World! . In Programming Concepts and Methods. North-Holland, Amsterdam, Netherlands, 1–21.Google ScholarGoogle Scholar
  55. Philip Wadler. 2003. Call-by-Value is Dual to Call-by-Name . In ICFP. ACM, New York, NY, USA, 189–201. Google ScholarGoogle ScholarDigital LibraryDigital Library
  56. Philip Wadler. 2012. Propositions as Sessions . In ICFP. ACM, New York, NY, USA, 273–286. Google ScholarGoogle ScholarDigital LibraryDigital Library
  57. Philip Wadler and Peter Thiemann. 2003. The Marriage of Effects and Monads . Transactions on Computational Logic 4, 1 (2003), 1–32. Google ScholarGoogle ScholarDigital LibraryDigital Library
  58. Noam Zeilberger. 2009. The Logical Basis of Evaluation Order and Pattern-Matching . Ph.D. Dissertation. Carnegie Mellon University, Pittsburgh, Pennsylvania, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Strict and lazy semantics for effects: layering monads and comonads

            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

            • Article Metrics

              • Downloads (Last 12 months)71
              • Downloads (Last 6 weeks)10

              Other Metrics

            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!