F# 测量单位,通用性问题 2
继这个问题之后,我似乎仍在与可能的前沿,尽管我不认为我正在做任何特别前沿的事情:
type Vector2d = { X: float<'u>; Y: float<'u> }
给我错误FS0039:未定义测量单位参数'u'。
并
type Vector2d = { X: float<_>; Y: float<_> }
给出我错误FS0191:此声明中不允许使用匿名测量单位变量。
是否是函数可以处理“通用”测量单位,但类型不能?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
应该可以解决这个问题
注意:从 1.9.6.2 CTP 版本开始这是正确的,但此 api 目前被视为不稳定
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