How do I say „Here's a trait Lookup
with a get(key: String): Option[V]
method which Map[String, V]
already happens to implement”?
I tried
trait Lookup[V] {
def get(key: String): Option[V]
}
but then I get
[error] 30 | override def get(): Lookup[mine.Object] = Map(
[error] | ^
[error] |Found: Map[String, Infrastructure]
[error] |Required: dsd.ctms.afs.validation.Lookup[Infrastructure]
and I don't understand why. I can define trait Lookup[V] {def get(key: String): V}
and then it's implemented by Map
, but that is not the semantics I mean to capture.