Question

Following on from this question, I still seem to be battling at the frontiers of what is possible, though I don't think that I'm doing anything particularly bleeding edge:

type Vector2d = { X: float<'u>; Y: float<'u> }

Gives me error FS0039: The unit-of-measure parameter 'u' is not defined.

And

type Vector2d = { X: float<_>; Y: float<_> }

Gives me error FS0191: anonymous unit-of-measure variables are not permitted in this declaration.

Is it the case that functions can handle 'generic' units of measure, but types can't?

Was it helpful?

Solution

type Vector2d<[<Measure>]'u> = { X: float<'u>; Y: float<'u> }

should do the trick

Note: This is correct as of the 1.9.6.2 CTP release but this api is not currently viewed as stable

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top