Extending typeclass defined parametrically from typeclass defined using Self type member

My question regards the new typeclass syntax introduced with the experimental.modularity feature set.

I want to define a typeclass Lattice { type Self }, which ought to extend the already existing PartialOrdering[T] typeclass. I’m really enjoying the new Self member type syntax, and am using it throughout my project. Is there anyway I can define Lattice using the new syntax, and still extend PartialOrdering[T]? Something akin to trait Lattice extends PartialOrdering[this.Self]?

Welcome to the Scala community @erik1 :waving_hand:

I don’t know the answer to your question (haven’t used the new syntax yet), but just to get the ball rolling, do you mean a “new syntax equivalent” of:

trait Lattice extends PartialOrdering[Lattice]
1 Like

No that would not work, unfortunately. You can’t use this in parent types. We still have to figure out how to best blend parameters and type members in these cases.

2 Likes

Okay, understood. Thanks for the reply

That’s not quite what I’m looking for. I want the Lattice typeclass to extend the PartialOrdering typeclass. If I was using the old syntax I could achieve this as follows: trait Lattice[T] extends PartialOrdering[T].

1 Like