Consider these 3 types: MyGeneric[I, O], TypeA and TypeB. TypeA and TypeB are not related.
If possible at all, how do I express the constraint that if I is TypeA then O is TypeB and if I is a subtype of TypeB then O is a subtype of I?
Let me say that most probably I can, and should, rethink this code.
But I thought it would be a good idea to ask and see if Scala can accomodate such a peculiar requirement and which areas I need to study more.
@BalmungSan I’m using the 3.6.0 nightly from a few days ago, are some of your suggestions more useful with this version, compared to others?
Anyway, thanks for the pointers, I will look into those topics.
I had already tried match types but couldn’t accomplish much with them.
I will try again.
Wrapper ADT is probably the most obvious / easiest solution, I would try to go for path dependent types (since Scala 3 type system is based on it so it’s worth learning). Though it depends on what you want to do…