## Arrows, like monads, are monoids (2006)

### Cached

### Download Links

- [chris.chris-lotte.net]
- [www.comlab.ox.ac.uk]
- [www.cs.ox.ac.uk]
- CiteULike
- DBLP

### Other Repositories/Bibliography

Venue: | Proc. of 22nd Ann. Conf. on Mathematical Foundations of Programming Semantics, MFPS XXII, v. 158 of Electron. Notes in Theoret. Comput. Sci |

Citations: | 12 - 1 self |

### BibTeX

@INPROCEEDINGS{Heunen06arrows,like,

author = {Chris Heunen and Bart Jacobs},

title = {Arrows, like monads, are monoids},

booktitle = {Proc. of 22nd Ann. Conf. on Mathematical Foundations of Programming Semantics, MFPS XXII, v. 158 of Electron. Notes in Theoret. Comput. Sci},

year = {2006},

pages = {219--236},

publisher = {Elsevier}

}

### Years of Citing Articles

### OpenURL

### Abstract

Monads are by now well-established as programming construct in functional languages. Recently, the notion of “Arrow ” was introduced by Hughes as an extension, not with one, but with two type parameters. At first, these Arrows may look somewhat arbitrary. Here we show that they are categorically fairly civilised, by showing that they correspond to monoids in suitable subcategories of bifunctors C op ×C → C. This shows that, at a suitable level of abstraction, arrows are like monads — which are monoids in categories of functors C → C. Freyd categories have been introduced by Power and Robinson to model computational effects, well before Hughes ’ Arrows appeared. It is often claimed (informally) that Arrows are simply Freyd categories. We shall make this claim precise by showing how monoids in categories of bifunctors exactly correspond to Freyd categories.

### Citations

920 |
Categories for the Working Mathematician
- Lane
- 1971
(Show Context)
Citation Context ...ll that a monad on a category C consists of an endofunctor M : C → C, a unit natural transformation η : 1 • → M, and a multiplication natural transformation µ: M 2 • → M satisfying familiar equations =-=[17]-=-. Usually, a monoid is described as a set M together with an associative binary operation m : M ×M → M with a unit e ∈ M. Category theory provides an abstract framework to work in different “universes... |

440 | Computational lambda-calculus and monads
- Moggi
- 1989
(Show Context)
Citation Context ... in Electronic Notes in Theoretical Computer Science URL: www.elsevier.nl/locate/entcssHeunen, Jacobs • Arrows are meant as extensions of Monads — which are well-established in functional programming =-=[18,30]-=-. Indeed, for a monad M, the mapping (X, Y ) ↦→ M(Y ) X is a well-known instance of an Arrow. But the intended analogy between Monads and Arrows has not yet been further substantiated. It is a standar... |

113 |
Metric spaces, generalized logic, and closed categories
- Lawvere
- 1974
(Show Context)
Citation Context ...tors acting on types and terms. The most complicated ingredient was the tensor product ⊗. It was constructed like the tensor product of profunctors (or distributors) generalising relation composition =-=[16]-=-, see also [4]. One other complication involves size. The big coproduct in the previous section uses all objects of the category T as indices. This requires T to be both small and (co)complete. At thi... |

112 | Categorical Logic and Type Theory - Jacobs - 1999 |

99 | Premonoidal categories and notions of computation
- Power, Robinson
- 1997
(Show Context)
Citation Context ...make the minor change of considering monoids in categories of bifunctors C op × C → Sets — with Sets instead of C as codomain — we can establish a one-to-one correspondence with Freyd categories from =-=[23]-=-. Hence the monoid description gives a different view on the subject, namely one in which the emphasis lies on the fact that an Arrow is a mapping from both input and output types to a type of computa... |

61 |
Abelian categories. An introduction to the theory of functors
- Freyd
- 1964
(Show Context)
Citation Context ... our work in Section 5. The occurrence of the name Freyd is also very appropriate in our setting, because we encounter several issues, like dinaturality and small completeness, on which he has worked =-=[8,2,9]-=-. Our view of Arrows as monoids also provides another approach to Freyd categories. Section 5 concludes by proving that both models, monoids and Freyd categories, coincide in the relevant case. ∼= � 2... |

57 | Deterministic, error-correcting combinator parsers
- SWIERSTRA, DUPONCHEEL
- 1996
(Show Context)
Citation Context ...ise functions to combine. However, these restrictions are strict enough to exclude certain classes of libraries from implementation with a monadic interface, most notably efficient parser combinators =-=[27,14]-=-. 2.2 Arrows Arrows [11,20] are even more general functional combinators, and can be seen as a generalisation of monads, as we will see in example 2.2. An Arrow in Haskell is a type constructor class ... |

48 | A new notation for arrows
- Paterson
- 2001
(Show Context)
Citation Context ...of bifunctors C op × C → C. In fact, this entire paper is just an explanation of this one-line summary. There are several reasons why this result might appeal. • Arrows have been introduced by Hughes =-=[11,19]-=- in the context of functional programming, to the rather applied end of fitting certain parsers into a general interface (see [10] for more applications). The notion comes without much motivation, and... |

37 |
Report on the programming language haskell 98, a non-strict, purely functional language
- Jones, Hughes
- 1985
(Show Context)
Citation Context ...plicitly carrying states around. Monads can efficiently structure functional programs while improving genericity. This mechanism is even deemed important enough to be incorporated into Haskell syntax =-=[21]-=-. A monad in Haskell is defined as a type class: class Monad M where return :: X → M X (>>=) :: M X → (X → M Y ) → M Y To ensure the desired behaviour, the programmer herself should prove certain mona... |

34 | A small complete category - Hyland - 1987 |

32 |
Generalising Monads to Arrows. Science of Computer Programming, 37:67–111, May 2000. R. van der Meyden. Finite State Implementations of Knowledge-Based Programs
- Hughes
(Show Context)
Citation Context ...of bifunctors C op × C → C. In fact, this entire paper is just an explanation of this one-line summary. There are several reasons why this result might appeal. • Arrows have been introduced by Hughes =-=[11,19]-=- in the context of functional programming, to the rather applied end of fitting certain parsers into a general interface (see [10] for more applications). The notion comes without much motivation, and... |

25 | Polytypic data conversion programs
- Jansson, Jeuring
- 2002
(Show Context)
Citation Context ...ise functions to combine. However, these restrictions are strict enough to exclude certain classes of libraries from implementation with a monadic interface, most notably efficient parser combinators =-=[27,14]-=-. 2.2 Arrows Arrows [11,20] are even more general functional combinators, and can be seen as a generalisation of monads, as we will see in example 2.2. An Arrow in Haskell is a type constructor class ... |

18 | V.: The Essence of Dataflow Programming
- Uustalu, Vene
(Show Context)
Citation Context ...consider Arrows behaving monadically in their domain. In functional language: Kleisli Arrows take care of bookkeeping in the output, so why not build Arrows that take care of bookkeeping in the input =-=[29,28]-=-? Since an Arrow C op × C → Sets is contravariant in its ‘domain’, we must start from a monad on C op . That is, if N is a comonad, then we obtain an Arrow via (X, Y ) ↦→ HomC(NX, Y ). Even more gener... |

17 | Basic category theory - Poigné - 1992 |

14 |
Handbook of Categorical Algebra. Encyclopedia of Math. and its applications
- Borceux
- 1994
(Show Context)
Citation Context ...types and terms. The most complicated ingredient was the tensor product ⊗. It was constructed like the tensor product of profunctors (or distributors) generalising relation composition [16], see also =-=[4]-=-. One other complication involves size. The big coproduct in the previous section uses all objects of the category T as indices. This requires T to be both small and (co)complete. At this stage it is ... |

12 |
Modelling User Interfaces in a Functional Language
- Courtney
- 2004
(Show Context)
Citation Context ...hat are incompatible with a monadic interface. Applications can be found on the website [10], for example in the aforementioned parser combinators, in reactive programming [15] and in user interfaces =-=[6]-=-. Example 2.1 (Pure functions) The first example of Arrows that comes to mind is, naturally, ordinary functions. In Haskell this is written as follows. instance Arrow (→) where arr f = f f >>> g = g ◦... |

12 | Arrows and computation
- Paterson
(Show Context)
Citation Context ...owever, these restrictions are strict enough to exclude certain classes of libraries from implementation with a monadic interface, most notably efficient parser combinators [27,14]. 2.2 Arrows Arrows =-=[11,20]-=- are even more general functional combinators, and can be seen as a generalisation of monads, as we will see in example 2.2. An Arrow in Haskell is a type constructor class of the form: class Arrow A ... |

10 | A recursive do for Haskell
- Erkök, Launchbury
- 2002
(Show Context)
Citation Context ...e no such claim. But one does notice several variations and extensions of Arrows appearing, such as Biarrows [1], or a need for recursion schemes, and thus the need for a foundation, of monads/Arrows =-=[7,3,19]-=-. Our categorical reformulation as monoids might give guidance for the proper formulation of such variations. Acknowledgement We are indebted to the anonymous reviewers for their comments and suggesti... |

9 |
Modularity and Dyads
- Power, Robinson
- 1999
(Show Context)
Citation Context ... op × C → Sets is contravariant in its ‘domain’, we must start from a monad on C op . That is, if N is a comonad, then we obtain an Arrow via (X, Y ) ↦→ HomC(NX, Y ). Even more generally, as in [29], =-=[24]-=- or even [5], we can try to build Arrows behaving monadically in both their domain and codomain at once. Given a strong monad M, a comonad N, and a distributive law λ: NM • → MN between them we obtain... |

8 | R.: There and back again: arrows for invertible programming
- Alimarine, Smetsers, et al.
- 2005
(Show Context)
Citation Context ...e question comes up: does this help functional programmers in any way? At this stage we have no such claim. But one does notice several variations and extensions of Arrows appearing, such as Biarrows =-=[1]-=-, or a need for recursion schemes, and thus the need for a foundation, of monads/Arrows [7,3,19]. Our categorical reformulation as monoids might give guidance for the proper formulation of such variat... |

7 | Traced premonoidal categories
- Benton, Hyland
(Show Context)
Citation Context ...e no such claim. But one does notice several variations and extensions of Arrows appearing, such as Biarrows [1], or a need for recursion schemes, and thus the need for a foundation, of monads/Arrows =-=[7,3,19]-=-. Our categorical reformulation as monoids might give guidance for the proper formulation of such variations. Acknowledgement We are indebted to the anonymous reviewers for their comments and suggesti... |

6 | Environments, continuation semantics and indexed categories, in
- Power, Thielecke
- 1997
(Show Context)
Citation Context ...s. The non-bifunctoriality reflects the order of side-effects when we think of D as a category of ‘computations’. When we include a category C of ‘values’, we arrive at the notion of a Freyd category =-=[23,25,26]-=-. Definition 5.3 A Freyd category consists of a symmetric premonoidal category D together with a category C with finite products, and an identity-onobjects functor J : C → D that preserves all structu... |

5 | Closed Freyd- and κ-categories
- Power, Thielecke
- 1999
(Show Context)
Citation Context ...onentiation as unit. In doing so we shall give a simplification of one of the Arrow operations (namely first) introduced by Hughes, see Proposition 3.4. Arrows have been studied categorically before: =-=[26]-=- use Freyd categories (from [23]) as models of Arrows. We shall elaborate on the relation with our work in Section 5. The occurrence of the name Freyd is also very appropriate in our setting, because ... |

5 | Signals and comonads
- Uustalu, Vene
- 2005
(Show Context)
Citation Context ...consider Arrows behaving monadically in their domain. In functional language: Kleisli Arrows take care of bookkeeping in the output, so why not build Arrows that take care of bookkeeping in the input =-=[29,28]-=-? Since an Arrow C op × C → Sets is contravariant in its ‘domain’, we must start from a monad on C op . That is, if N is a comonad, then we obtain an Arrow via (X, Y ) ↦→ HomC(NX, Y ). Even more gener... |

4 |
Functorial polymorphism. Theoretical computer science
- Bainbridge, Freyd, et al.
- 1990
(Show Context)
Citation Context ... our work in Section 5. The occurrence of the name Freyd is also very appropriate in our setting, because we encounter several issues, like dinaturality and small completeness, on which he has worked =-=[8,2,9]-=-. Our view of Arrows as monoids also provides another approach to Freyd categories. Section 5 concludes by proving that both models, monoids and Freyd categories, coincide in the relevant case. ∼= � 2... |

4 |
Monads for functional programming. Program design calculi
- Wadler
- 1993
(Show Context)
Citation Context ... in Electronic Notes in Theoretical Computer Science URL: www.elsevier.nl/locate/entcssHeunen, Jacobs • Arrows are meant as extensions of Monads — which are well-established in functional programming =-=[18,30]-=-. Indeed, for a monad M, the mapping (X, Y ) ↦→ M(Y ) X is a well-known instance of an Arrow. But the intended analogy between Monads and Arrows has not yet been further substantiated. It is a standar... |

1 |
Structural polymorphism, Theoretical Computer Science 115
- Freyd
- 1993
(Show Context)
Citation Context ... our work in Section 5. The occurrence of the name Freyd is also very appropriate in our setting, because we encounter several issues, like dinaturality and small completeness, on which he has worked =-=[8,2,9]-=-. Our view of Arrows as monoids also provides another approach to Freyd categories. Section 5 concludes by proving that both models, monoids and Freyd categories, coincide in the relevant case. ∼= � 2... |