Breaking a monad-comonad symmetry between computational effects

Abstract : Computational effects may often be interpreted in the Kleisli category of a monad or in the coKleisli category of a comonad. The duality between monads and comonads corresponds, in general, to a symmetry between construction and observation, for instance between raising an exception and looking up a state. Thanks to the properties of adjunction one may go one step further: the coKleisli-on-Kleisli category of a monad provides a kind of observation with respect to a given construction, while dually the Kleisli-on-coKleisli category of a comonad provides a kind of construction with respect to a given observation. In the previous examples this gives rise to catching an exception and updating a state. However, the interpretation of computational effects is usually based on a category which is not self-dual, like the category of sets. This leads to a breaking of the monad-comonad duality. For instance, in a distributive category the state effect has much better properties than the exception effect. This remark provides a novel point of view on the usual mechanism for handling exceptions. The aim of this paper is to build an equational semantics for handling exceptions based on the coKleisli-on-Kleisli category of the monad of exceptions. We focus on n-ary functions and conditionals. We propose a programmer's language for exceptions and we prove that it has the required behaviour with respect to n-ary functions and conditionals.
Complete list of metadatas

Cited literature [29 references]  Display  Hide  Download

https://hal.archives-ouvertes.fr/hal-00941653
Contributor : Dominique Duval <>
Submitted on : Tuesday, February 4, 2014 - 10:29:14 AM
Last modification on : Thursday, July 4, 2019 - 9:54:02 AM
Long-term archiving on : Monday, May 5, 2014 - 1:50:14 AM

Files

exceptions.pdf
Files produced by the author(s)

Identifiers

  • HAL Id : hal-00941653, version 1
  • ARXIV : 1402.1051

Collections

Citation

Jean-Guillaume Dumas, Dominique Duval, Jean-Claude Reynaud. Breaking a monad-comonad symmetry between computational effects. [Research Report] arXiV. 2014. ⟨hal-00941653⟩

Share

Metrics

Record views

355

Files downloads

411