The methods on Histograms should be written to take into account the variance implied by the histogram hierarchy. Otherwise, asInstanceOf calls become necessary (not nice)
// StreamingHistogram *is* Histogram[Double], and should be treated like it
val someTile: Tile = ???
val otherTile: Tile = ???
val h1 = StreamingHistogram.fromTile(someTile)
val h2 = StreamingHistogram.fromTile(otherTile)
The compiler is not satisfied that h1 and h2 (Histogram[Double] subtypes) can be merged
val mergeFail = h1 merge h2
This works, is ugly:
val mergeSucc = h1 merge h2.asInstanceOf[Histogram[Double]]
The methods on
Histograms should be written to take into account the variance implied by the histogram hierarchy. Otherwise,asInstanceOfcalls become necessary (not nice)The compiler is not satisfied that h1 and h2 (Histogram[Double] subtypes) can be merged
This works, is ugly: