This question is closely related to these ones (1, 2, 3)
I\'m using an external library which doens\'t (yet) handle units of measure. I want to be able to \
For now, boxing and casting appears to work:
let MyUnitAwareClient (s:float<'u>) =
let result = s |> float |> ExternalNonUnitAwareFunction
(box result :?> float<'u>)
I wouldn't be surprised if the units of measure stuff goes through some further changes before release, though, which might break this. You can also make a more generic version, such as:
let reunit (f:float -> float) (v:float<'u>) =
let unit = box 1. :?> float<'u>
unit * (f (v/unit))
EDIT
There is now a FloatWithMeasure
function to 'cast to units':
http://msdn.microsoft.com/en-us/library/ee806527(VS.100).aspx