module UnitsOfMeasure
-[<Measure>]
-type px
+[<Measure>] type px
+[<Measure>] type μm
+[<Measure>] type inch
+[<Measure>] type ppi = px / inch
-[<Measure>]
-type μm =
- static member ConvertToInch(x: float<μm>) : float<inch> =
- x * 1.<inch> / 25.4e3<μm>
+let μmInchRatio = 25.4e3<μm/inch>
-and [<Measure>] inch
+let μmToInch(x: float<μm>) : float<inch> = x / μmInchRatio
+let inchToμm(x: float<inch>) : float<μm> = x * μmInchRatio
-[<Measure>]
-type ppi = px / inch