scala - Implicits from subclass -
i trying implement template method pattern implicits. class top class 2 extensions.
class defining template pattern , has method dosomething(). method uses several implicits inside. class abstract.
class b , class c extending class a, providing implicits in scope, implementing other abstract methods , no more abstract.
example (using spray's pipeline):
a: abstract class a[t <: : manifest] { .... abstract def method: partialfunction[t,unit] //not interesting def dosomething() { //method using implicit parser httpresponse -> t val responsefuture: future[t] = pipeline(get(url)) responsefuture.onsuccess(method) } } b: import caseclassb._ //importing implicits transfer httpresponse -> caseclassb class b extends a[caseclassb] { def method: partialfunction[caseclassb,unit] = {//not interesting} } this setting not work (compilation of class fails because of "could not find implicit value evidence parameter"). there better way how overcome problem without need have "implicit abstract def" in class need overriden? reason don't class b , class c providing implicits using imports.
Comments
Post a Comment