scala2.11的repl下增加了kind命令

scala2.11的repl中新增了kind命令,见这里,对于kind的理解也可参考之前的文章

不过,下载了scala2.11-m3版本,发现kind命令并没有用 *号的方式来表达.

scala> :k Int
scala.Int's kind is A

scala> :k class Test{}
Test's kind is A

scala> :k List
scala.collection.immutable.List's kind is F[+A]

scala> :k class C[M[_]]
C's kind is X[F[A]]

scala> :k class C[M2[M1[_]]]
C's kind is Y[X[F[A]]]

对于自身类型,kind命令不采用*号表示,而是用 A 来表示。对于构造器类型 * -> * 采用 F[A]描述。

Leave a Reply

Your email address will not be published. Required fields are marked *