这是功能:
def execute[T, U, F[_]](t: T)(implicit
executor: Executor[F],
functor: Functor[F],
handler: Handler[T, U],
manifest: Manifest[U]): F[Response[U]] = {(do something)}
我有一个ElasticSearchRepositoryWrapper
类,它从某个地方(我从哪里找不到)handler
变量继承。我有一个类repo = ElasticSearchRepositoryWrapper(client, config, configName)
的实例我想这样做:
class SomeService(val config: Config,
val configName: String = "products",
val client: ElasticClient)
(implicit val ec: ExecutionContext)
{
repo = ElasticSearchRepositoryWrapper(client, config, configName)
repo.client.execute {
repo.delete(something)
}
}
但说,No implicits found for parameter handler: Handler[..., ...]
用于execute
功能因此,如何将handler
从repo
传递给它?注意:如果类SomeService
从ElasticSearchRepositoryWrapper
继承,则会找到它。
execute
的第一个参数是什么。似乎需要一些t
,但您正在传递一个块(并不是说它一定是错误的,而是有点奇怪)。但是,假设这确实是您想要的,并且可以访问repo.handler
,则可以像这样传递它: repo.client.execute(repo.delete(something))(ec, implicitly, repo.handler, implicitly)