Last active
March 26, 2018 13:47
-
-
Save wennergr/0455d4021e17cc5612ddf3b1647c1087 to your computer and use it in GitHub Desktop.
This file contains 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
// Monad version | |
for { | |
firstName <- Some("Bob") | |
lastName <- Some("Axel") | |
} yield firstname + " " + lastName // Some("Bob Axel") | |
// Applicative functor version | |
Applicative[Option].map2(Some("Bob"), Some("Axel"))((a,b) => a + " " + b) // Some("Bob Axel") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment