Check out F#'s units of measure. http://msdn.microsoft.com/en-us/library/dd233243.aspx
[<Measure>] type s
[<Measure>] type m
[<Measure>] type km
let mtokm (x:float<m>) = x * 1.<km>/1000.<m>
//the types of g and ground are inferred
let drop g ground (x0:float<m>) =
let mutable x = x0 //type inferred here
let mutable t = 0.0<s>
let mutable v = 0.0<m/s>
let dt = 0.01<s>
while x >= ground do
v <- v + g*dt
x <- x + v*dt
t <- t + dt
t
> drop -10.0<m/s^2> 0.<m> 50.<m>
val it : float<s> = 3.16Edit: removed unrelated Wikipedia article (Unit Type)