I was under the impression that context bounds would work only on methods:
trait Target[T]
class Post {
def pinTo[T : Target](t:T)
}
apparently context bounds can be used in class
too (but not in trait
):
trait Target[T]
class Post[T: Target] {
def pintTo[T](t:T)
}
Now I'm confused as to how the evidence can be provided to Post
?
class Business
implicit object ev extends Target[Business] // is implicit necessary here ?
val p = new Post[Business] // ?? how do I provide ev ?