A possible workaround keeping the order you wished:
object A {
implicit val aFoo: FooTypeClass[A] = new FooTypeClass[A] {
def foo: A = new A {
override def toString = "a"
}
}
}
I keep on seeking for the explanation why object
(instead of val
) doesn't fit.