Extending units of measure to arbitrary types