I'm new to Scala programming, so please bear with me if it's a silly question. I was expecting the following code to work, since a
has a mkString
method.
val a = "abc".toCharArray
case class A[T: {def mkString(): String}](i: T) {
val s = i.mkString
}
A(a)
But it gives the following error:
Error:(3, 16) AnyRef{def mkString(): String} does not take type parameters case class A[T: {def mkString(): String}](i: T)
Error:(4, 14) value mkString is not a member of type parameter T val s = i.mkString
I'm using Scala 2.11.6.
Any help will be really appreciated! Thank you !