Unfortunately general comparison requires multiple dispatch, because it is
supposed to work regardless of the argument order.
For example, imagine that we provide a Comparable protocol and we implement
it in Elixir for Integer and Float. Now, the Decimal library will also
implement Comparable, and
Okay, I'm totally in love with this idea :)
*iex(1)>*
*defprotocol Comparable do @spec compare(t, t) :: :lt | :eq | :gt def
compare(a, b)enddefimpl Comparable, for: Integer do def compare(a, b) do
cond do a < b -> :lt a == b -> :eq a > b -> :gt