Created
January 18, 2010 18:49
-
-
Save retronym/280253 to your computer and use it in GitHub Desktop.
Monad vs Applicative Functor
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
| import scalaz._ | |
| import Scalaz._ | |
| val o1 = some(1) | |
| val o2 = some(2) | |
| val v1 = o1.<⊛>(o2, (_: Int) + (_: Int)) | |
| println(v1) | |
| val v2 = for { | |
| a <- o1 | |
| b <- o2 // more complex, because `a` is visible here, but not needed | |
| } yield a + b | |
| println(v2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment