Why can't scala find the implicit here?
class A class Foo { lazy val x = implicitly[A] implicit lazy val a = new A }
error: could not find implicit value for parameter e: A
But this works just fine:
class Foo { lazy val x = implicitly[A] implicit lazy val a: A = new A
specific class foo
FWIW I am stuck on scala 2.10 for this application. Also, replacing lazy val with def does not seem to change anything.
In my actual application, I have a file with a bunch of implications defined for different domain objects, some of which depend on each other. It seems like a nightmare to try to organize them in such a way that all dependencies come to their dependents, so I designated them as lazy . To explicitly declare the type of each of these vals muddies up the code, and it seems like this should be unnecessary. How to get around this?
Dylan source share