需要什么方法来创建自定义 Applicative Functor 以与 scalaz |@| 一起使用

What methods are needed to create custom Applicative Functor to use with scalaz |@|

我希望能够使用 scalaz 的 |@|在我自己的应用函子上。

示例:
val spread: Source[Yield] = (y2 |@| y1)(_ - _)

这是我的class

sealed abstract class Source[+A] {
  def map[B](f: A => B): Source[B] 
  def unit[A](a: A): Source[A]
  def pureList[A](la: List[A]): Source[A]
  def zero[A]: Source[A]
  def map2[A, B, C](as: Source[A], bs: Source[B], f: (A, B) => C): Source[C]
}

我确定我必须实现 map 因为它是一个函子。
应用程序可以通过多种方式实现:例如使用 apply()unit()map2()unit()

我还需要 appure 吗?

如您所见,我不确定需要什么。

implicit val mya = new Applicative[Source] {}

让编译器为您回答这个问题:

object creation impossible, since:
it has 2 unimplemented members.
/** As seen from <$anon: scalaz.Applicative[Source]>, the missing signatures are as follows.
 *  For convenience, these are usable as stub implementations.
 */
  // Members declared in scalaz.Applicative
  def point[A](a: => A): Source[A] = ???

  // Members declared in scalaz.Apply
  def ap[A, B](fa: => Source[A])(f: => Source[A => B]): Source[B] = ???