scala> def a[A](b:Seq[A]) = b.toArray
<console>:7: error: could not find implicit value
for evidence parameter of type ClassManifest[A]
def a[A](b:Seq[A]) = b.toArray
^
What is the problem here? And how can I work around this?
What you have to do is to specify the returnable type, this will work (for scala < 2.8):
Due to the new Collections framework which had to do special kind of conversion in order to handle Arrays like Collections see Fighting bit rot page 448, we have to tell about the high-order type, and it’s the meaning of
ClassManifestwhich tells about the class (there is aManifestthat is wider).So both examples below are valid (more information here Collections API Explained):