Arrows, like Monads, are Monoids
نویسندگان
چکیده
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 Cop×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.
منابع مشابه
Categorical semantics for arrows
Arrows are an extension of the well-established notion of a monad in functional programming languages. This article presents several examples and constructions, and develops denotational semantics of arrows as monoids in categories of bifunctors C×C→ C. Observing similarities to monads – which are monoids in categories of endofunctors C→ C – it then considers Eilenberg-Moore and Kleisli constru...
متن کاملNotions of Computation as Monoids
There are different notions of computation, the most popular being monads, applicative functors, and arrows. In this article we show that these three notions can be seen as monoids in a monoidal category. We demonstrate that at this level of abstraction one can obtain useful results which can be instantiated to the different notions of computation. In particular, we show how free constructions ...
متن کاملMonads Need Not Be Endofunctors
We introduce a generalisation of monads, called relative monads, allowing for underlying functors between different categories. Examples include finite-dimensional vector spaces, untyped and typed λ-calculus syntax and indexed containers. We show that the Kleisli and Eilenberg-Moore constructions carry over to relative monads and are related to relative adjunctions. Under reasonable assumptions...
متن کاملIdioms are Oblivious, Arrows are Meticulous, Monads are Promiscuous
We revisit the connection between three notions of computation: Moggi’s monads, Hughes’s arrows and McBride and Paterson’s idioms (also called applicative functors). We show that idioms are equivalent to arrows that satisfy the type isomorphism A;B ' 1 ; (A→ B) and that monads are equivalent to arrows that satisfy the type isomorphism A; B ' A → (1 ; B). Further, idioms embed into arrows and ar...
متن کاملProbabilities, distribution monads, and convex categories
Probabilities are understood abstractly as forming a monoid in the category of effect algebras. They can be added, via a partial operation, and multiplied. This generalises key properties of the unit interval [0, 1]. Such effect monoids can be used to define a probability distribution monad, again generalising the situation for [0, 1]-probabilities. It will be shown that there are translations ...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
عنوان ژورنال:
- Electr. Notes Theor. Comput. Sci.
دوره 158 شماره
صفحات -
تاریخ انتشار 2006