Quantum mechanics is used to calculate the norms of wave functions in a flat linear space. A quantum gravity theory will be used to calculate norms of wave functions in curved space. That will be the explicit goal of this post. Quaternions come with a metric, a means of taking 4 numbers and returning a scalar. It might seem natural to explore variations on Hamilton's rules shown above.
Riemannian geometry uses that strategy.
When working with a field like quaternions, that approach bothers me because Hamilton's rules are fundamental to the very definition of a quaternion. It may cause a compatibility problem. Here is a different approach which generalizes the scalar of the square while being consistent with Hamilton's rules. If g is the identity matrix. Then then result is the flat Minkowski interval.