Here, Evan says this about infix operators:
I think all of the successful ones have two things in common:
They have some visual relation to their meaning. For example,
</>
and<?>
from the URL parsing library exactly mimic the/
and?
symbols in URLs. And|>
indicates directionality really clearly. The math operators like+
and/
are directly related to the math operators taught in every school in the world.They use the visually simple symbols. I have never seen
#
or%
or@
or$
used to create an excellent operator. I think it is partly that they are so busy visually, mixing curves and lines haphazardly. It is also partly that they do not have super strong cultural meanings as infix operators in general. E.g.$4
means four dollars, but what is3$4
?
The cons operator (::
) has the second property, but not the first. It is a symmetrical operator, so it doesn’t show directionality. And it’s not symbol from something (e.g. math or urls) that is familiar to the user of the operator. This operator is a bit confusing, especially for beginners.
Maybe it should be replaced with something like :>
which shows directionality. It shows that something is being pushed to the list on the right. More importantly, it’s asymmetrical, which shows that it takes different data types on both sides.