## The arrow calculus (2008)

Citations: | 7 - 3 self |

### BibTeX

@TECHREPORT{Lindley08thearrow,

author = {Sam Lindley and Philip Wadler and Jeremy Yallop},

title = {The arrow calculus},

institution = {},

year = {2008}

}

### OpenURL

### Abstract

Abstract. We introduce the arrow calculus, a metalanguage for manipulating Hughes’s arrows with close relations both to Moggi’s metalanguage for monads and to Paterson’s arrow notation. Arrows are classically defined by extending lambda calculus with three constructs satisfying nine (somewhat idiosyncratic) laws. In contrast, the arrow calculus adds four constructs satisfying five laws. Two of the constructs are arrow abstraction and application (satisfying beta and eta laws) and two correspond to unit and bind for monads (satisfying left unit, right unit, and associativity laws). The five laws were previously known to be sound; we show that they are also complete, and hence that the five laws may replace the nine. We give a translation from classic arrows into the arrow calculus to complement Paterson’s desugaring and show that the two translations form an equational correspondence in the sense of Sabry and Felleisen. We are also the first to publish formal type rules (which are unusual in that they require two contexts), which greatly aided our understanding of arrows. The first fruit of our new calculus is to reveal some redundancies in the classic formulation: the nine classic arrow laws can be reduced to eight, and the three additional classic arrow laws for arrows with apply can be reduced to two. The calculus has also been used to clarify the relationship between idioms, arrows and monads and as the inspiration for a categorical semantics of arrows. 1

### Citations

732 | Notions of computation and monads
- Moggi
- 1991
(Show Context)
Citation Context ...ategorical semantics of arrows. 1 Introduction Arrows belong in the quiver of every functional programmer, ready to pierce hard problems through their heart. Arrows [4] generalise the monads of Moggi =-=[9]-=- and the idioms of McBride and Paterson [8]. They are closely related to Freyd categories, discovered independently from Hughes by Power, Robinson and Thielecke [11, 12]. Arrows enjoy a wide range of ... |

162 | Generalising monads to arrows
- Hughes
(Show Context)
Citation Context ...nads and as the inspiration for a categorical semantics of arrows. 1 Introduction Arrows belong in the quiver of every functional programmer, ready to pierce hard problems through their heart. Arrows =-=[4]-=- generalise the monads of Moggi [9] and the idioms of McBride and Paterson [8]. They are closely related to Freyd categories, discovered independently from Hughes by Power, Robinson and Thielecke [11,... |

161 | Reasoning about programs in continuation-passing style
- Sabry, Felleisen
- 1993
(Show Context)
Citation Context ...rules finally into print. – We show the two translations from classic arrows to arrow calculus and back are exactly inverse, providing an equational correspondence in the sense of Sabry and Felleisen =-=[13]-=-. The reader’s reaction may be to say, ‘Of course the translations are inverses, how could they be otherwise?’ But in fact the more common situation is for forward and backward translations to compose... |

99 | Premonoidal categories and notions of computation
- Power, Robinson
- 1997
(Show Context)
Citation Context ... [4] generalise the monads of Moggi [9] and the idioms of McBride and Paterson [8]. They are closely related to Freyd categories, discovered independently from Hughes by Power, Robinson and Thielecke =-=[11, 12]-=-. Arrows enjoy a wide range of applications, including parsers and printers [5], web interaction [4], circuits [10], graphic user interfaces [2], and robotics [3]. Formally, arrows are defined by exte... |

93 | A mixed linear non-linear logic: proofs, terms and models
- Benton
- 1995
(Show Context)
Citation Context ... interesting generalizations of arrows, inspired by the formulation proposed in this paper, possibly related to Indexed Freyd Models (Atkey, 2008) or to a generalization of Benton’s Adjoint Calculus (=-=Benton, 1995-=-). This paper is organized as follows. Section 2 reviews the classic formulation of arrows. Section 3 introduces the arrow calculus. Section 4 translates the arrow calculus into classic arrows, and vi... |

69 | Applicative Programming With Effects
- McBride, Paterson
- 2008
(Show Context)
Citation Context ...ion Arrows belong in the quiver of every functional programmer, ready to pierce hard problems through their heart. Arrows [4] generalise the monads of Moggi [9] and the idioms of McBride and Paterson =-=[8]-=-. They are closely related to Freyd categories, discovered independently from Hughes by Power, Robinson and Thielecke [11, 12]. Arrows enjoy a wide range of applications, including parsers and printer... |

48 | Arrows, robots, and functional reactive programming
- Hudak, Courtney, et al.
- 2002
(Show Context)
Citation Context ...by Power, Robinson and Thielecke [11, 12]. Arrows enjoy a wide range of applications, including parsers and printers [5], web interaction [4], circuits [10], graphic user interfaces [2], and robotics =-=[3]-=-. Formally, arrows are defined by extending simply-typed lambda calculus with three constants satisfying nine laws. And here is where the problems start. While some of the laws are easy to remember, o... |

48 | A new notation for arrows
- Paterson
- 2001
(Show Context)
Citation Context ...ategories, discovered independently from Hughes by Power, Robinson and Thielecke [11, 12]. Arrows enjoy a wide range of applications, including parsers and printers [5], web interaction [4], circuits =-=[10]-=-, graphic user interfaces [2], and robotics [3]. Formally, arrows are defined by extending simply-typed lambda calculus with three constants satisfying nine laws. And here is where the problems start.... |

38 | Genuinely functional user interfaces
- Courtney, Elliott
- 2001
(Show Context)
Citation Context ...ently from Hughes by Power, Robinson and Thielecke [11, 12]. Arrows enjoy a wide range of applications, including parsers and printers [5], web interaction [4], circuits [10], graphic user interfaces =-=[2]-=-, and robotics [3]. Formally, arrows are defined by extending simply-typed lambda calculus with three constants satisfying nine laws. And here is where the problems start. While some of the laws are e... |

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 ...also complete, and hence that the five laws may replace the nine. 1 Introduction Arrows belong in the quiver of every functional programmer, ready to pierce hard problems through their heart. Arrows (=-=Hughes, 2000-=-) generalise the monads of Moggi (1991) and the idioms of McBride and Paterson (2008). They are closely related to Freyd categories, discovered independently from Hughes by Power, Robinson and Thielec... |

22 | Polytypic compact printing and parsing
- JANSSON, JEURING
- 1999
(Show Context)
Citation Context ...They are closely related to Freyd categories, discovered independently from Hughes by Power, Robinson and Thielecke [11, 12]. Arrows enjoy a wide range of applications, including parsers and printers =-=[5]-=-, web interaction [4], circuits [10], graphic user interfaces [2], and robotics [3]. Formally, arrows are defined by extending simply-typed lambda calculus with three constants satisfying nine laws. A... |

11 |
Closed Freyd- and kappa-categories
- Power, Thielecke
- 1999
(Show Context)
Citation Context ... [4] generalise the monads of Moggi [9] and the idioms of McBride and Paterson [8]. They are closely related to Freyd categories, discovered independently from Hughes by Power, Robinson and Thielecke =-=[11, 12]-=-. Arrows enjoy a wide range of applications, including parsers and printers [5], web interaction [4], circuits [10], graphic user interfaces [2], and robotics [3]. Formally, arrows are defined by exte... |

9 |
What is a categorical model of arrows
- Atkey
(Show Context)
Citation Context ...us has already proven useful in practice. It enabled us to clarify the relationship between idioms, arrows and monads [7]. Further, it provided the inspiration for the categorical semantics of arrows =-=[1]-=-. This paper is organized as follows. Section 2 reviews the classic formulation of arrows. Section 3 introduces the arrow calculus. Section 4 translates the arrow calculus into classic arrows, and vic... |

7 |
Idioms are oblivious, arrows are meticulous, monads are promiscuous
- Lindley, Wadler, et al.
- 2008
(Show Context)
Citation Context ...three constants, we can understand the three constants by translating them to it! Elsewhere, we have already applied the arrow calculus to elucidate the connections between idioms, arrows, and monads =-=[7]-=-. Arrow calculus was not the main focus of that paper, where it was a tool to an end, and that paper has perhaps too terse a description of the calculus. This paper was in fact written before the othe... |

3 |
A new notation for arrows. Pages 229–240 of: International conference on functional programming
- Paterson
- 2001
(Show Context)
Citation Context ...lecke (Power & Robinson, 1997; Power & Thielecke, 1999). Arrows enjoy a wide range of applications, including parsers and printers (Jansson & Jeuring, 1999), web interaction (Hughes, 2000), circuits (=-=Paterson, 2001-=-), graphic user interfaces (Courtney & Elliott, 2001), and robotics (Hudak et al., 2003). Formally, arrows are defined by extending simply-typed lambda calculus with three constants satisfying nine la... |

2 |
What is a categorical model of arrows? Mathematical structures in functional programming
- Atkey
- 2008
(Show Context)
Citation Context ... has already proven useful. It enabled us to clarify the relationship between idioms, arrows and monads (Lindley et al., 2008b), and it provided the inspiration for a categorical semantics of arrows (=-=Atkey, 2008-=-). In private correspondence, Eugenio Moggi and Robert Atkey have suggested that there may be interesting generalizations of arrows, inspired by the formulation proposed in this paper, possibly relate... |

2 |
Genuinely functional user interfaces. Pages 41–69 of: Haskell workshop
- Courtney, Elliott
- 2001
(Show Context)
Citation Context ...elecke, 1999). Arrows enjoy a wide range of applications, including parsers and printers (Jansson & Jeuring, 1999), web interaction (Hughes, 2000), circuits (Paterson, 2001), graphic user interfaces (=-=Courtney & Elliott, 2001-=-), and robotics (Hudak et al., 2003). Formally, arrows are defined by extending simply-typed lambda calculus with three constants satisfying nine laws. And here is where the problems start. While some... |

2 |
Polytypic compact printing and parsing. Pages 273–287 of: European symposium on programming
- Jansson, Jeuring
- 1999
(Show Context)
Citation Context ...es, discovered independently from Hughes by Power, Robinson and Thielecke (Power & Robinson, 1997; Power & Thielecke, 1999). Arrows enjoy a wide range of applications, including parsers and printers (=-=Jansson & Jeuring, 1999-=-), web interaction (Hughes, 2000), circuits (Paterson, 2001), graphic user interfaces (Courtney & Elliott, 2001), and robotics (Hudak et al., 2003). Formally, arrows are defined by extending simply-ty... |