Reputation: 11542
The compiler is complaining about the code below, saying: missing parameter type for expanded function
I'm not sure how to make it happy. Any ideas?
def unwrapMap(m: Map[_, _]) =
{ (vcType: String) =>
m.map {
case (k, v) => {
(k,v) // echo the map for sample purposes
}
}.toMap
}
Upvotes: 0
Views: 82
Reputation: 9862
You should give concrete types to your Map instead of discarding them with '_':
def unwrapMap[A, B](m: Map[A, B]) =
{ (vcType: String) =>
m.map {
case (k, v) => {
(k,v) // echo the map for sample purposes
}
}.toMap
}
That way the compiler can infer the type of the anonymous function created into the method '.map'.
Upvotes: 1