F# Unit-of-measure type parameters


Example

The [<Measure>] attribute can be used on type parameters to declare types that are generic with respect to units of measure:

type CylinderSize<[<Measure>] 'u> =
    { Radius : float<'u>
      Height : float<'u> }

Test usage:

open Microsoft.FSharp.Data.UnitSystems.SI.UnitSymbols

/// This has type CylinderSize<m>.
let testCylinder =
    { Radius = 14.<m>
      Height =  1.<m> }