Last active
January 2, 2016 08:29
-
-
Save kevinmeredith/8277018 to your computer and use it in GitHub Desktop.
Question wrt Applicative#apply from FP in Scala
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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