Use type class to dispatch depending on the arity of the operator.