I'm trying to create a trait that has a generic function that returns a slick Query
and has a value of that function compiled, like this:
trait fn1[A1, E, U, C[_]] {
protected def asc(a1: A1): Query[E, U, C]
val Asc = Compiled(asc _)
}
But when I try to compile I get this error:
Computation of type A1 => test.this.profile.api.Query[E,U,C] cannot be compiled (as type C)
val Asc = Compiled(asc _)
because scala cannot infer the implicit parameter compilable: Compilable[V, C]
of Compiled.apply
The problem is the type parameter A1
, indeed this would compile without problems:
trait fn1[E, U, C[_]] {
protected def asc(a1: Rep[Long]): Query[E, U, C]
val Asc = Compiled(asc _)
}
I'm using slick 3.2.3
How can I make scala infer the right implicit?
Asc
alazy val
or there is a risk of using uninitialised data in that call toasc
. – Tim