scala - classOf[] for a higher-kinded type -


given class foo[f[_]], how class object? usual syntax doesn't work:

scala> classof[foo[_]] <console>:9: error: _$1 takes no type parameters, expected: 1               classof[foo[_]]                           ^ 

neither does

scala> classof[foo[_[_]]] <console>:9: error: _$1 not take type parameters               classof[foo[_[_]]]                           ^ 

ah, right. leaving in case looks it:

scala> classof[foo[f] forsome { type f[_] }] warning: there 1 feature warning(s); re-run -feature details res0: class[foo[_[_] <: any]] = class foo 

Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -