Given class Foo[F[_]]
, how do I get the Class
object? The usual syntax doesn't work:
scala> classOf[Foo[_]]
<console>:9: error: _$1 takes no type parameters, expected: one
classOf[Foo[_]]
^
Neither does
scala> classOf[Foo[_[_]]]
<console>:9: error: _$1 does not take type parameters
classOf[Foo[_[_]]]
^
Ah, right. Leaving this in case someone looks for it:
scala> classOf[Foo[F] forSome { type F[_] }]
warning: there were 1 feature warning(s); re-run with -feature for details
res0: Class[Foo[_[_] <: Any]] = class Foo