Arrow (computer science)
In computer science, arrows or bolts are a type class used in computer programming to describe computations in a pure and declarative fashion.[src] First proposed by computer scientist John Hughes as a generalization of monads, arrows provide a referentially transparent way to express relationships between logical steps in a computation.[src] Unlike monads, arrows don't limit steps to having one and only one input.[src] As a result, they have found use in functional reactive programming, tacit programming (point-free style), parsers, and in other uses.[src]
In computer science, arrows or bolts are a type class used in computer programming to describe computations in a pure and declarative fashion.[src] First proposed by computer scientist John Hughes as a generalization of monads, arrows provide a referentially transparent way to express relationships between logical steps in a computation.[src] Unlike monads, arrows don't limit steps to having one and only one input.[src] As a result, they have found use in functional reactive programming, tacit programming (point-free style), parsers, and in other uses.[src] arr : (s -> t) -> A s t A piping method that takes an arrow between two types and converts it into an arrow between tuples.[src] The first elements in the tuples represent the portion of the input and output that is altered, while the second elements are a third type describing an unaltered portion that bypasses the computation.[src] first : A s t -> A (s,u) (t,u) As all arrows must be categories, they inherit a third operation from the class of categories: A composition operator that can attach a second arrow to a first as long as the first function's output and the second's input have matching types.[src] (>>>) : A s t -> A t u -> A s u Although only these three procedures are strictly needed to define an arrow, other methods can be derived to make arrows easier to work with in practice and theory.[src] One more helpful method can be derived from and (and from which can be derived): A merging operator that takes two arrows, possibly with different input and output types, and fuses them into one arrow between two compound types.[src] The merge operator is not necessarily commutative.[src] (***) : A s t -> A u v -> A (s,u) (t,v) arr id == id When connecting two functions & , the required arrow operations must distribute over compositions from the left.[src] arr (f >>> g) == arr f >>> arr g first (f >>> g) == first f >>> first g In the previous laws, piping can be applied directly to functions because order must be irrelevant when piping & lifting occur together.[src] arr (first f) == first (arr f) The remaining laws restrict how the piping method behaves when the order of a composition is reversed, also allowing for simplifying expressions: If an identity is merged with a second function to form an arrow, attaching it to a piped function must be commutative.[src] arr (id *** g) >>> first f == first f >>> arr (id *** g) Piping a function before type simplification must be equivalent to simplifying type before connecting to the unpiped function.[src] first f >>> arr ((s,t) -> s) == arr ((s,t) -> s) >>> f Finally, piping a function twice before reassociating the resulting tuple, which is nested, should be the same as reassociating the nested tuple before attaching a single bypass of the function.[src] In other words, stacked bypasses can be flattened by first bundling together those elements unchanged by the function.[src] first (first f) >>> arr ( ((s,t),u) -> (s,(t,u)) ) == arr ( ((s,t),u) -> (s,(t,u)) ) >>> first f[src]
21 sentences · 21 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Arrow (computer science)." encyclopegia.org, 2025, https://encyclopegia.org/wiki/arrow-computer-science. Accessed 27 November 2026.
Chicago
"Arrow (computer science)." encyclopegia.org. Accessed November 27, 2026. https://encyclopegia.org/wiki/arrow-computer-science.
APA
encyclopegia.org. (2025). Arrow (computer science). Retrieved November 27, 2026, from https://encyclopegia.org/wiki/arrow-computer-science
Accessed November 27, 2026 · CC BY-SA 4.0 · citation page · JSON