<s>
In	O
computer	B-General_Concept
science	I-General_Concept
,	O
arrows	B-Application
or	O
bolts	O
are	O
a	O
type	O
class	O
used	O
in	O
programming	O
to	O
describe	O
computations	O
in	O
a	O
pure	B-Application
and	O
declarative	B-Language
fashion	O
.	O
</s>
<s>
First	O
proposed	O
by	O
computer	O
scientist	O
John	O
Hughes	O
as	O
a	O
generalization	O
of	O
monads	O
,	O
arrows	B-Application
provide	O
a	O
referentially	O
transparent	O
way	O
of	O
expressing	O
relationships	O
between	O
logical	O
steps	O
in	O
a	O
computation	O
.	O
</s>
<s>
Unlike	O
monads	O
,	O
arrows	B-Application
do	O
n't	O
limit	O
steps	O
to	O
having	O
one	O
and	O
only	O
one	O
input	O
.	O
</s>
<s>
As	O
a	O
result	O
,	O
they	O
have	O
found	O
use	O
in	O
functional	B-Application
reactive	I-Application
programming	I-Application
,	O
point-free	B-Application
programming	I-Application
,	O
and	O
parsers	B-Language
among	O
other	O
applications	O
.	O
</s>
<s>
While	O
arrows	B-Application
were	O
in	O
use	O
before	O
being	O
recognized	O
as	O
a	O
distinct	O
class	O
,	O
it	O
was	O
n't	O
until	O
2000	O
that	O
John	O
Hughes	O
first	O
published	O
research	O
focusing	O
on	O
them	O
.	O
</s>
<s>
Until	O
then	O
,	O
monads	O
had	O
proven	O
sufficient	O
for	O
most	O
problems	O
requiring	O
the	O
combination	O
of	O
program	O
logic	O
in	O
pure	B-Application
code	O
.	O
</s>
<s>
However	O
,	O
some	O
useful	O
libraries	B-Library
,	O
such	O
as	O
the	O
Fudgets	B-Library
library	O
for	O
graphical	B-Application
user	I-Application
interfaces	I-Application
and	O
certain	O
efficient	O
parsers	B-Language
,	O
defied	O
rewriting	O
in	O
a	O
monadic	O
form	O
.	O
</s>
<s>
The	O
formal	O
concept	O
of	O
arrows	B-Application
was	O
developed	O
to	O
explain	O
these	O
exceptions	O
to	O
monadic	O
code	O
,	O
and	O
in	O
the	O
process	O
,	O
monads	O
themselves	O
turned	O
out	O
to	O
be	O
a	O
subset	O
of	O
arrows	B-Application
.	O
</s>
<s>
Since	O
then	O
,	O
arrows	B-Application
have	O
been	O
an	O
active	O
area	O
of	O
research	O
.	O
</s>
<s>
In	O
category	O
theory	O
,	O
the	O
Kleisli	O
categories	O
of	O
all	O
monads	O
form	O
a	O
proper	O
subset	O
of	O
Hughes	O
arrows	B-Application
.	O
</s>
<s>
While	O
Freyd	O
categories	O
were	O
believed	O
to	O
be	O
equivalent	O
to	O
arrows	B-Application
for	O
a	O
time	O
,	O
it	O
has	O
since	O
been	O
proven	O
that	O
arrows	B-Application
are	O
even	O
more	O
general	O
.	O
</s>
<s>
In	O
fact	O
,	O
arrows	B-Application
are	O
not	O
merely	O
equivalent	O
,	O
but	O
directly	O
equal	O
to	O
enriched	O
Freyd	O
categories	O
.	O
</s>
<s>
Like	O
all	O
type	O
classes	O
,	O
arrows	B-Application
can	O
be	O
thought	O
of	O
as	O
a	O
set	O
of	O
qualities	O
that	O
can	O
be	O
applied	O
to	O
any	O
data	O
type	O
.	O
</s>
<s>
In	O
the	O
Haskell	B-Language
programming	I-Language
language	I-Language
,	O
arrows	B-Application
allow	O
functions	O
(	O
represented	O
in	O
Haskell	B-Language
by	O
->	O
symbol	O
)	O
to	O
combine	O
in	O
a	O
reified	O
form	O
.	O
</s>
<s>
However	O
,	O
the	O
actual	O
term	O
"	O
arrow	O
"	O
may	O
also	O
come	O
from	O
the	O
fact	O
that	O
some	O
(	O
but	O
not	O
all	O
)	O
arrows	B-Application
correspond	O
to	O
the	O
morphisms	O
(	O
also	O
known	O
as	O
"	O
arrows	B-Application
"	O
in	O
category	O
theory	O
)	O
of	O
different	O
Kleisli	O
categories	O
.	O
</s>
<s>
The	O
description	O
currently	O
used	O
by	O
the	O
Haskell	B-Language
standard	B-Library
libraries	I-Library
requires	O
only	O
three	O
basic	O
operations	O
:	O
</s>
<s>
A	O
piping	O
method	O
that	O
takes	O
an	O
arrow	O
between	O
two	O
types	O
and	O
converts	O
it	O
into	O
an	O
arrow	O
between	O
tuples	B-Application
.	O
</s>
<s>
The	O
first	O
elements	O
in	O
the	O
tuples	B-Application
represent	O
the	O
portion	O
of	O
the	O
input	O
and	O
output	O
that	O
is	O
altered	O
,	O
while	O
the	O
second	O
elements	O
are	O
a	O
third	O
type	O
describing	O
an	O
unaltered	O
portion	O
that	O
bypasses	O
the	O
computation	O
.	O
</s>
<s>
As	O
all	O
arrows	B-Application
must	O
be	O
categories	O
,	O
they	O
inherit	B-Language
a	O
third	O
operation	O
from	O
the	O
class	O
of	O
categories	O
:	O
A	O
composition	B-Application
operator	O
that	O
can	O
attach	O
a	O
second	O
arrow	O
to	O
a	O
first	O
as	O
long	O
as	O
the	O
first	O
function	O
's	O
output	O
and	O
the	O
second	O
's	O
input	O
have	O
matching	O
types	O
.	O
</s>
<s>
Although	O
only	O
these	O
three	O
procedures	O
are	O
strictly	O
necessary	O
to	O
define	O
an	O
arrow	O
,	O
other	O
methods	O
can	O
be	O
derived	O
to	O
make	O
arrows	B-Application
easier	O
to	O
work	O
with	O
in	O
practice	O
and	O
theory	O
.	O
</s>
<s>
A	O
merging	O
operator	O
that	O
takes	O
two	O
arrows	B-Application
,	O
possibly	O
with	O
different	O
input	O
and	O
output	O
types	O
,	O
and	O
fuses	O
them	O
into	O
one	O
arrow	O
between	O
two	O
compound	O
types	O
.	O
</s>
<s>
In	O
addition	O
to	O
having	O
some	O
well-defined	O
procedures	O
,	O
arrows	B-Application
must	O
obey	O
certain	O
rules	O
for	O
any	O
types	O
they	O
may	O
be	O
applied	O
to	O
:	O
</s>
<s>
Arrows	B-Application
must	O
always	O
preserve	O
all	O
types	O
 '	O
identities	O
(	O
essentially	O
the	O
definitions	O
of	O
all	O
values	O
for	O
all	O
types	O
within	O
a	O
category	O
)	O
.	O
</s>
<s>
The	O
remaining	O
laws	O
restrict	O
how	O
the	O
piping	O
method	O
behaves	O
when	O
the	O
order	O
of	O
a	O
composition	B-Application
is	O
reversed	O
,	O
also	O
allowing	O
for	O
simplifying	O
expressions	O
:	O
</s>
<s>
Finally	O
,	O
piping	O
a	O
function	O
twice	O
before	O
reassociating	O
the	O
resulting	O
tuple	B-Application
,	O
which	O
is	O
nested	O
,	O
should	O
be	O
the	O
same	O
as	O
reassociating	O
the	O
nested	O
tuple	B-Application
before	O
attaching	O
a	O
single	O
bypass	O
of	O
the	O
function	O
.	O
</s>
<s>
Arrows	B-Application
may	O
be	O
extended	O
to	O
fit	O
specific	O
situations	O
by	O
defining	O
additional	O
operations	O
and	O
restrictions	O
.	O
</s>
<s>
Commonly	O
used	O
versions	O
include	O
arrows	B-Application
with	O
choice	O
,	O
which	O
allow	O
a	O
computation	O
to	O
make	O
conditional	B-Language
decisions	O
,	O
and	O
arrows	B-Application
with	O
feedback	O
,	O
which	O
allow	O
a	O
step	O
to	O
take	O
its	O
own	O
outputs	O
as	O
inputs	O
.	O
</s>
<s>
Another	O
set	O
of	O
arrows	B-Application
,	O
known	O
as	O
arrows	B-Application
with	O
application	O
,	O
are	O
rarely	O
used	O
in	O
practice	O
because	O
they	O
are	O
actually	O
equivalent	O
to	O
monads	O
.	O
</s>
<s>
Arrows	B-Application
have	O
several	O
benefits	O
,	O
mostly	O
stemming	O
from	O
their	O
ability	O
to	O
make	O
program	O
logic	O
explicit	O
yet	O
concise	O
.	O
</s>
<s>
Besides	O
avoiding	O
side	O
effects	O
,	O
purely	B-Application
functional	I-Application
programming	I-Application
creates	O
more	O
opportunities	O
for	O
static	O
code	O
analysis	O
.	O
</s>
<s>
This	O
in	O
turn	O
can	O
theoretically	O
lead	O
to	O
better	O
compiler	B-Application
optimizations	I-Application
,	O
easier	O
debugging	O
,	O
and	O
features	O
like	O
syntax	O
sugar	O
.	O
</s>
<s>
Although	O
no	O
program	O
strictly	O
requires	O
arrows	B-Application
,	O
they	O
generalize	O
away	O
much	O
of	O
the	O
dense	O
function	B-Application
passing	I-Application
that	O
pure	B-Application
,	O
declarative	B-Language
code	O
would	O
otherwise	O
require	O
.	O
</s>
<s>
The	O
ability	O
to	O
apply	O
to	O
types	O
generically	O
also	O
contributes	O
to	O
reusability	O
and	O
keeps	O
interfaces	B-Application
simple	O
.	O
</s>
<s>
Arrows	B-Application
do	O
have	O
some	O
disadvantages	O
,	O
including	O
the	O
initial	O
effort	O
of	O
defining	O
an	O
arrow	O
that	O
satisfies	O
the	O
arrow	O
laws	O
.	O
</s>
<s>
Because	O
monads	O
are	O
usually	O
easier	O
to	O
implement	O
,	O
and	O
the	O
extra	O
features	O
of	O
arrows	B-Application
may	O
be	O
unnecessary	O
,	O
it	O
is	O
often	O
preferable	O
to	O
use	O
a	O
monad	O
.	O
</s>
<s>
Another	O
issue	O
,	O
which	O
applies	O
to	O
many	O
functional	B-Language
programming	I-Language
constructs	O
,	O
is	O
efficiently	O
compiling	B-Language
code	O
with	O
arrows	B-Application
into	O
the	O
imperative	B-Application
style	O
used	O
by	O
computer	O
instruction	B-General_Concept
sets	I-General_Concept
.	O
</s>
<s>
Due	O
to	O
the	O
requirement	O
of	O
having	O
to	O
define	O
an	O
arr	O
function	O
to	O
lift	O
pure	B-Application
functions	I-Application
,	O
the	O
applicability	O
of	O
arrows	B-Application
is	O
limited	O
.	O
</s>
<s>
For	O
example	O
,	O
bidirectional	O
transformations	O
cannot	O
be	O
arrows	B-Application
,	O
because	O
one	O
would	O
need	O
to	O
provide	O
not	O
only	O
a	O
pure	B-Application
function	I-Application
,	O
but	O
also	O
its	O
inverse	O
,	O
when	O
using	O
arr	O
.	O
</s>
<s>
This	O
also	O
limits	O
the	O
use	O
of	O
arrows	B-Application
to	O
describe	O
push-based	O
reactive	O
frameworks	O
that	O
stop	O
unnecessary	O
propagation	O
.	O
</s>
<s>
Similarly	O
,	O
the	O
use	O
of	O
pairs	O
to	O
tuple	B-Application
values	O
together	O
results	O
in	O
a	O
difficult	O
coding	O
style	O
that	O
requires	O
additional	O
combinators	O
to	O
re-group	O
values	O
,	O
and	O
raises	O
fundamental	O
questions	O
about	O
the	O
equivalence	O
of	O
arrows	B-Application
grouped	O
in	O
different	O
ways	O
.	O
</s>
<s>
These	O
limitations	O
remain	O
an	O
open	O
problem	O
,	O
and	O
extensions	O
such	O
as	O
Generalized	O
Arrows	B-Application
and	O
N-ary	O
FRP	O
explore	O
these	O
problems	O
.	O
</s>
<s>
Much	O
of	O
the	O
utility	O
of	O
arrows	B-Application
is	O
subsumed	O
by	O
more	O
general	O
classes	O
like	O
Profunctor	O
(	O
which	O
requires	O
only	O
pre	O
-	O
and	O
postcomposition	O
with	O
functions	O
)	O
,	O
which	O
have	O
application	O
in	O
optics	O
.	O
</s>
