Handlers of Algebraic Effects

  • Gordon Plotkin
  • Matija Pretnar
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5502)

Abstract

We present an algebraic treatment of exception handlers and, more generally, introduce handlers for other computational effects representable by an algebraic theory. These include nondeterminism, interactive input/output, concurrency, state, time, and their combinations; in all cases the computation monad is the free-model monad of the theory. Each such handler corresponds to a model of the theory for the effects at hand. The handling construct, which applies a handler to a computation, is based on the one introduced by Benton and Kennedy, and is interpreted using the homomorphism induced by the universal property of the free model. This general construct can be used to describe previously unrelated concepts from both theory and practice.

References

  1. 1.
    Benton, N., Hughes, J., Moggi, E.: Monads and effects. In: Barthe, G., Dybjer, P., Pinto, L., Saraiva, J. (eds.) APPSEM 2000. LNCS, vol. 2395, pp. 42–122. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  2. 2.
    Benton, N., Kennedy, A.: Exceptional syntax. Journal of Functional Programming 11(4), 395–410 (2001)MathSciNetCrossRefMATHGoogle Scholar
  3. 3.
    Clocksin, W.F., Mellish, C.: Programming in Prolog, 3rd edn. Springer, Heidelberg (1987)CrossRefMATHGoogle Scholar
  4. 4.
    Enderton, H.B.: A Mathematical Introduction to Logic, 2nd edn. Academic Press, London (2000)MATHGoogle Scholar
  5. 5.
    Filinski, A.: Representing layered monads. In: 26th Symposium on Principles of Programming Languages, pp. 175–188 (1999)Google Scholar
  6. 6.
    Flanagan, C., Sabry, A., Duba, B.F., Felleisen, M.: The essence of compiling with continuations. In: PLDI, pp. 237–247 (1993)Google Scholar
  7. 7.
    Grätzer, G.A.: Universal Algebra, 2nd edn. Springer, Heidelberg (1979)MATHGoogle Scholar
  8. 8.
    Hennessy, M., Milner, R.: Algebraic laws for nondeterminism and concurrency. Journal of the ACM 32(1), 137–161 (1985)MathSciNetCrossRefMATHGoogle Scholar
  9. 9.
    Hyland, M., Levy, P.B., Plotkin, G.D., Power, A.J.: Combining algebraic effects with continuations. Theoretical Computer Science 375(1-3), 20–40 (2007)MathSciNetCrossRefMATHGoogle Scholar
  10. 10.
    Hyland, M., Plotkin, G.D., Power, A.J.: Combining effects: Sum and tensor. Theoretical Computer Science 357(1-3), 70–99 (2006)MathSciNetCrossRefMATHGoogle Scholar
  11. 11.
    Levy, P.B.: Call-by-push-value: Decomposing call-by-value and call-by-name. Higher-Order and Symbolic Computation 19(4), 377–414 (2006)MathSciNetCrossRefMATHGoogle Scholar
  12. 12.
    Levy, P.B.: Monads and adjunctions for global exceptions. Electronic Notes in Theoretical Computer Science 158, 261–287 (2006)CrossRefMATHGoogle Scholar
  13. 13.
    Milner, R.: A Calculus of Communicating Systems. Springer, Heidelberg (1980)CrossRefMATHGoogle Scholar
  14. 14.
    Moggi, E.: Computational lambda-calculus and monads. In: 4th Symposium on Logic in Computer Science, pp. 14–23 (1989)Google Scholar
  15. 15.
    Moggi, E.: Notions of computation and monads. Information And Computation 93(1), 55–92 (1991)MathSciNetCrossRefMATHGoogle Scholar
  16. 16.
    Peyton Jones, S.L.: Haskell 98. Journal of Functional Programming 13(1), 255 (2003)MathSciNetMATHGoogle Scholar
  17. 17.
    Plotkin, G.D.: Some varieties of equational logic. In: Futatsugi, K., Jouannaud, J.-P., Meseguer, J. (eds.) Algebra, Meaning, and Computation. LNCS, vol. 4060, pp. 150–156. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  18. 18.
    Plotkin, G.D., Power, A.J.: Adequacy for algebraic effects. In: Honsell, F., Miculan, M. (eds.) FOSSACS 2001. LNCS, vol. 2030, pp. 1–24. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  19. 19.
    Plotkin, G.D., Power, A.J.: Notions of computation determine monads. In: Nielsen, M., Engberg, U. (eds.) FOSSACS 2002. LNCS, vol. 2303, pp. 342–356. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  20. 20.
    Plotkin, G.D., Power, A.J.: Algebraic operations and generic effects. Applied Categorical Structures 11(1), 69–94 (2003)MathSciNetCrossRefMATHGoogle Scholar
  21. 21.
    Plotkin, G.D., Power, A.J.: Computational effects and operations: An overview. Electronic Notes in Theoretical Computer Science 73, 149–163 (2004)CrossRefMATHGoogle Scholar
  22. 22.
    Plotkin, G.D., Pretnar, M.: A logic for algebraic effects. In: 23rd Symposium on Logic in Computer Science, pp. 118–129 (2008)Google Scholar
  23. 23.
    Power, A.J.: Countable Lawvere theories and computational effects. Electronic Notes in Theoretical Computer Science 161, 59–71 (2006)CrossRefMATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Gordon Plotkin
    • 1
  • Matija Pretnar
    • 1
  1. 1.Laboratory for Foundations of Computer Science, School of InformaticsUniversity of EdinburghScotland

Personalised recommendations