Suppose I have a type A
. How can I define a type B
in scala which is either Unit
or the tuple (A, B)
?
I want to model a type B[A]
which can be
(), (A, ()), (A, (A, ())), (A, (A, (A, ()))), (..., (A, (A, (A, ())))).
I have seen things like
trait B[A] extends (A, B) {}
or examples in
What does the `#` operator mean in Scala?
but was not able to work with what I found since the terminating Unit
possibility is missing.
Thank you.