I've been googling hours about scala type classes but I still can't figure out how to solve this problem:
def mkArray[A:Ordering](size:Int):Array[A] = {
Array.ofDim[A](size)
}
Basicly my problem was that I couldn“t create an array of type A:Ordering, so I tried bunch of things and ended up using function above. But it tells me that:
- not enough arguments for method ofDim: (implicit evidence$3: scala.reflect.ClassTag[A])Array[A]. Unspecified value parameter
evidence$3.
- No ClassTag available for A
So if you could tell me how to get around this problem and perhaps explain a bit whats going on in here, it would be much appreciated!