I would like to be able to do use scalaz's |@| on my own applicative functor.
Example:
val spread: Source[Yield] = (y2 |@| y1)(_ - _)
This is my 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]
}
I'm certain I have to implement map because it's a functor.
An applicative can be implemented in various ways: for example using apply() and unit() or map2() and unit().
Do I need ap and pure as well?
As you can see I'm not sure what is needed.