Scala implementation of Quaternion algebra