> double kilometerToMiles(double km) { return km / 1.6 }
But what if you could have `miles kilometersToMiles(kilometers km)`? Under the hood its the same old doubles but you would be able to catch errors such as the one that caused Surveyor failure [1].
e.g. Haskell has units[2] and dimensional[3] that allow you to do exactly that
But what if you could have `miles kilometersToMiles(kilometers km)`? Under the hood its the same old doubles but you would be able to catch errors such as the one that caused Surveyor failure [1].
e.g. Haskell has units[2] and dimensional[3] that allow you to do exactly that
[1] https://en.wikipedia.org/wiki/Mars_Climate_Orbiter#Cause_of_...
[2] https://github.com/goldfirere/units
[3] https://github.com/bjornbm/dimensional