Applicative

trait Applicative[F[_]] extends Functor[F] {
  def pure[A](a: A): F[A]
  def ap[A, B](f: F[A => B])(fa: F[A]): F[B]
  def map[A, B](fa: F[A])(f: A => B): F[B] =
    ap(pure(f))(fa)
}

object Applicative {
  import Functor._
  implicit class ApplicativeOps[A, B, F[_]: Applicative](f: F[A => B]) {
    def <*>(fa: F[A]): F[B] =
      implicitly[Applicative[F]].ap(f)(fa)
  }
  implicit class FnCofunctor[A, B](g: A => B) {
    def <%>[F[_]: Functor](x: F[A]) = x map g
  }
}

Dependencies