3 ms·
F# has unit support in the type system :)
by pharmakom 5y ago
F# has unit support in the type system :)
- S04dKHzrKT 5y agoAn example for unfamiliar folks. Many Languages var lengthInFeet = 2; var weightInKg = 2; var sum = lengthInFeet + weightInKg; // Runs without issue but is an error F# [<Measure>] type ft [<Measure>] type kg let lengthInFeet = 2<ft> let weightInKg = 2<kg> let sum = lengthInFeet + weightInKg // Compile time error More info at https://fsharpforfunandprofit.com/posts/units-of-measure/ https://fsharpforfunandprofit.com/posts/units-of-measure/