Is it possible to create somehow a context bound for a nested type? Something like this:
def f[T : U[List]](a: T)
Ofc, this is not Scala syntax, but illustrates what I want to achieve, that is, get a bound on an implicit U[List[T]]
. Is this possible?
Thanks.
You could do it with type alias:
type UList[X] = U[List[X]]
def f[T : UList](a: T)
or
def f[T:({type UL[X] = U[List[X]]})#UL](a: T)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.