Closed
Description
Suppose you have a hierarchy like this:
trait Foo[A]
trait Bar[A] extends Foo[A]
trait Baz[A] extends Bar[A]
trait FooLaws[A] given Foo[A]
trait BarLaws[A] given Bar[A] extends FooLaws[A]
trait BazLaws[A] given Baz[A] extends BarLaws[A]
It'd be nice to be able to write something like this:
def instance[A] given Baz[A]: BazLaws[A] = new BazLaws[A] {}
Instead of:
def instance[A] given Baz[A]: BazLaws[A] =
new BazLaws[A] with BarLaws[A] with FooLaws[A] {}
The former fails on the current nightly with:
1 |def instance[A] given Baz[A]: BazLaws[A] = new BazLaws[A] {}
| ^
| parameterized trait FooLaws is indirectly implemented,
| needs to be implemented directly so that arguments can be passed