Hostname: page-component-6766d58669-l4t7p Total loading time: 0 Render date: 2026-05-14T20:44:08.194Z Has data issue: false hasContentIssue false

Algebraic effects and handlers for arrows

Published online by Cambridge University Press:  03 October 2024

TAKAHIRO SANADA*
Affiliation:
Research Institute for Mathematical Sciences, Kyoto University, Japan, (e-mail: tsanada@fpu.ac.jp)
Rights & Permissions [Opens in a new window]

Abstract

We present an arrow calculus with operations and handlers and its operational and denotational semantics. The calculus is an extension of Lindley, Wadler and Yallop’s arrow calculus.

The denotational semantics is given using a strong (pro)monad $\mathcal{A}$ in the bicategory of categories and profunctors. The construction of this strong monad $\mathcal{A}$ is not trivial because of a size problem. To build denotational semantics, we investigate what $\mathcal{A}$-algebras are, and a handler is interpreted as an $\mathcal{A}$-homomorphisms between $\mathcal{A}$-algebras.

The syntax and operational semantics are derived from the observations on $\mathcal{A}$-algebras. We prove the soundness and adequacy theorem of the operational semantics for the denotational semantics.

Information

Type
Research Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2024. Published by Cambridge University Press
Figure 0

Table 1. Logic gates

Figure 1

Table 2. Analogy between profunctors and binary relations

Figure 2

Fig. 1. Axioms for a strong promonad.

Figure 3

Fig. 2. The syntax of the arrow calculus with operations and handlers.

Figure 4

Fig. 3. Typing rules for the arrow calculus with operations and handlers.

Figure 5

Fig. 4. Operational semantics.

Figure 6

Fig. 5. The evaluation of $\mathop{\mathbf{handle}} (\mathop{\mathbf{handle}} \mathsf{NAND}(\langle {\mathtt{true}}, {\mathtt{false}} \rangle) \mathop{\mathbf{with}} H'_1) \mathop{\mathbf{with}} H'_2$.

Figure 7

Fig. 6. The categorical semantics.

Figure 8

Fig. 7. Construction of $\mathrm{Arr}_{\Sigma}(A, B) \in \mathbf{Ens}$ for $A, B \in \mathbf{Set}$.

Figure 9

Fig. 8. In case $a = \mathsf{op}$.

Figure 10

Table 3. Translation between the arrow calculus and Paterson’s notation

Figure 11

Fig. D1. In case $a = \mathop{\mathrm{first}}\nolimits_X(a')$ and $a' \sim \mathop{\mathsf{nf}}\left({(\mathsf{op})_{i=1}^{n+1}}, {(f_i)_{i=1}^{n+1}}; {g}\right)$.

Figure 12

Fig. D2. In case $a = b \mathrel{>\!\!>\!\!>} c$ and $c \sim \mathop{\mathsf{nf}}\left({(\mathsf{op}_i)_{i=1}^{n + 1}}, {(f'_i)_{i = 1}^{n + 1}}; {g''}\right)$.

Submit a response

Discussions

No Discussions have been published for this article.