Skip to content

Instantly share code, notes, and snippets.

@kevinmeredith
Last active January 2, 2016 08:29
Show Gist options
  • Select an option

  • Save kevinmeredith/8277018 to your computer and use it in GitHub Desktop.

Select an option

Save kevinmeredith/8277018 to your computer and use it in GitHub Desktop.
Question wrt Applicative#apply from FP in Scala
trait Applicative[F[_]] extends Functor[F] {
def map2[A,B,C](fa: F[A], fb: F[B])(f: (A,B) => C): F[C]
def apply[A,B](fab: F[A => B])(fa: F[A]): F[B] =
map2(fa, fab)((x, f) => f(x))
// [code elided]
// Your comment says,
//> "the function being lifted here is `_(_)`,
//> which is the same as the lambda notation `(f, x) => f(x)`
// But, if I understand correctly, it should read `(x, f) => f(x)`
// since `fab` (from apply) is a F[A => B]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment