How can I define A and B depending from each other typed class using refined library?

拟墨画扇 提交于 2019-12-09 06:25:17

问题


Problem:

I have a case class Passenger, that starts from point A and goes to point B.

A valid passenger means that point A doesn't equal to point B.

Passenger(
  a: Int,
  b: Int
)

Question:

How can I design Passenger class using refind library to reach the goal?

I think Passenger should take two or one refined type parameters, something like:

    Passenger[A, B Refined NotEqual[A]](...)

Example:

I expect that the following code doesn't compile:

Passenger(42, 42)

And this compiles correctly:

Passenger(1, 42)

来源:https://stackoverflow.com/questions/53359774/how-can-i-define-a-and-b-depending-from-each-other-typed-class-using-refined-lib

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!