A type-safe means for working with measures