In an effort to apply Manifest on a Higher-kinded-type, we notice the difference between Seq and Option, then the type alias Seq and the direct class scala.collection.Seq.
scala> class MyType[F[_]]
warning: there was one feature warning; re-run with -feature for details
defined class MyType
scala> def bar[T: Manifest](t: T) = {}
bar: [T](t: T)(implicit evidence$1: Manifest[T])Unit
scala> bar(new MyType[Seq])
<console>:14: error: No Manifest available for MyType[Seq].
bar(new MyType[Seq])
^
scala> bar(new MyType[Option])
<console>:14: error: kinds of the type arguments (Option) do not conform to the expected kinds of the type parameters (type T).
Option's type parameters do not match type T's expected parameters:
class Option has one type parameter, but type T has none
bar(new MyType[Option])
^
scala> bar(new MyType[scala.collection.Seq])
<console>:14: error: kinds of the type arguments (Seq) do not conform to the expected kinds of the type parameters (type T).
Seq's type parameters do not match type T's expected parameters:
trait Seq has one type parameter, but type T has none
bar(new MyType[scala.collection.Seq])
I’m curious about why and the underlying mechanism, thanks!