States and exceptions considered as dual effects

Source: arXiv


In this paper we consider the two major computational effects of states and
exceptions, from the point of view of diagrammatic logics. We get a surprising
result: there exists a symmetry between these two effects, based on the
well-known categorical duality between products and coproducts. More precisely,
the lookup and update operations for states are respectively dual to the throw
and catch operations for exceptions. This symmetry is deeply hidden in the
programming languages; in order to unveil it, we start from the monoidal
equational logic and we add progressively the logical features which are
necessary for dealing with either effect. This approach gives rise to a new
point of view on states and exceptions, which bypasses the problems due to the
non-algebraicity of handling exceptions.

Download full-text


Available from: Jean-Guillaume Dumas, Oct 05, 2015
8 Reads
  • Source
    • "In this note we focus on the denotational semantics of exceptions and states, so that the sets of states and exceptions are used explicitly. However, with additional logical tools, the duality may be expressed in a way which fits better with the syntax of effects [Dumas et al. 2010]. "
    [Show abstract] [Hide abstract]
    ABSTRACT: In this short note we study the semantics of two basic computational effects, exceptions and states, from a new point of view. In the handling of exceptions we dissociate the control from the elementary operation which recovers from the exception. In this way it becomes apparent that there is a duality, in the categorical sense, between exceptions and states.
    Mathematical Structures in Computer Science 12/2011; 22(4). DOI:10.1017/S0960129511000752 · 0.45 Impact Factor