I can't seem to understand why my program needs explicit parameter types for this case. Using the following method:
trait DistTraversableLike[+T, +Repr]
extends DistTraversable[T] {
self: Repr =>
...
def scan1lD[T1 >: T, That](assOp: (T1, T1) => T1)(implicit bf: CanBuildFrom[Repr, T1, That]): That = {
val b = bf(this)
for (x <- group.prefixSumSeq(part, assOp))
b += x
b.result
}
}
I try to use it on a specific implementation like so:
val x:DistSeq[Int] = DistSeq((0 until worldSize): _*)
val scan = x.scan1lD(_+_)
Which yields the following error message:
Multiple markers at this line
- missing parameter type for expanded function ((x$1: <error>, x$2) => x$1.$plus{<null>}(x$2{<null>}){<null>})
{<null>}
- missing parameter type for expanded function ((x$1, x$2) => x$1.$plus{<null>}(x$2{<null>}){<null>}){<null>}
- missing parameter type for expanded function ((x$1: <error>, x$2) => x$1.$plus(x$2))
- missing parameter type for expanded function ((x$1, x$2) => x$1.$plus(x$2))
group is a mixed trait using a method from FooParOps-trait (prototype implementation):
def prefixSumSeq[T](part: Seq[T], combiner: (T, T) => T): Seq[T] = {
implicit val srlz = getSerializerFor(part)
var result = part.head
var msg = part.reduce(combiner)
for (i <- 0 until log2i(size)) {
val partner = localRank ^ math.pow(2, i).toInt
send(partner, msg)
val number: T = rcv(partner)
msg = combiner(msg, number)
if (partner < localRank) result = combiner(number, result)
}
return (part.tail).scanLeft(result)(combiner)
}
part
is from DistTraversable[+T]
and defined as def part: Seq[T]
I don't quite see why explicit parameters are needed here? Please tell me if more information is needed. The program is quite complex right now.