Pre-SIP derives clauses for opaque types

Personally I have some doubts regarding the position of derives clauses. To me it would feel more consistent to put them on the left side of the definition, e.g.

opaque type USD derives Show = Int

as this influences the type alias itself rather than it’s implementation, similarly to how we place type bounds, e.g

opaque type USD <: Currency = Int

On the other hand with might look weird when we derive a lot of type classes, e.g.

opaque type USD
  derives Foo1
  derives Foo2
  derives Foo3 = Int

There was also a proposal allowing to pass extra parameters to derives clauses explicitly Ergonomics of configurable derivation. I’m wondering if these two features could work well together.

3 Likes