Created
July 24, 2018 22:05
-
-
Save tzachz/4dbd8054426e7e434b885dbb800f8128 to your computer and use it in GitHub Desktop.
CompositionFinal
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
// Now we can count on flapMap to do the magic! | |
def processRequest(a: A): Future[Result] = { | |
for { | |
b <- f1(a) | |
c <- flip(b.map(f2)) | |
d <- flip(c.map(f3)) | |
r <- flip(d.map(f4)) | |
} yield r.getOrElse[Result](r.left.get) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment