Scala:实现 Numeric 的子类型[T]
如何实现 Numeric[T] 的子类型? 我一直在寻找这方面的指南,但没有找到。 子类型的示例可以是理性的还是复杂的?
提前致谢 特罗尔斯
How does one go about implementing a subtype of Numeric[T]?
I have been looking for at guide on this but haven't found any.
Example of subtypes could be Rational or Complex?
Thanks in advance
Troels
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一个绝对无用的字符串数字:
An absolutely useless String Numeric:
我添加了 Real 到 Scalaz,具有实例
Real[Double]
和Real[Dual]
。我发现使
fromDouble
隐式化很方便I added Real to Scalaz, with instances
Real[Double]
andReal[Dual]
.I found it convenient to make
fromDouble
implicit