【发布时间】:2011-11-23 14:18:12
【问题描述】:
谁能解释嵌套在泛型中的结构类型的奇怪构造:
implicit def Function1Functor[R]: Functor[({type λ[α]=(R) => α})#λ] =
new Functor[({type λ[α]=(R) => α})#λ] ....
此示例来自 Scalaz 库:Functor.scala
为什么需要这种结构?写起来再简单不过了:
implicit def Function1Functor[R,A]: Functor[R =>A]
或
implicit def Function1Functor[R,A]: Functor[Function1[R,A]]
【问题讨论】:
标签: scala scalaz structural-typing