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

582 views Asked by At

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)
0

There are 0 answers