scala中的类型参数定义

时间:2012-10-17 17:27:33

标签: scala scalaz

  

可能重复:
  What are type lambdas in Scala and what are their benefits?

  1. 如何解决此类型定义:Pure[({type ?[a]=(R, a)})#?]

  2. 使用这种结构的原因是什么?

  3. Snipped来自scalaz库:

    trait Pure[P[_]] {
      def pure[A](a: => A): P[A]
    }
    
    object Pure {
      import Scalaz._
    //...
      implicit def Tuple2Pure[R: Zero]: Pure[({type ?[a]=(R, a)})#?] = new Pure[({type ?[a]=(R, a)})#?] {
      def pure[A](a: => A) = (Ø, a)
      }
    
    //...
    }
    

0 个答案:

没有答案