Created
May 18, 2018 18:36
-
-
Save bijancn/c2a3a456a12c0d0157e2dde3d9658f03 to your computer and use it in GitHub Desktop.
Lessons learned from a fistful of functors
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
// Do you know this annoying feeling when you repeat a small function twice? Like | |
val x = X.doSomeStuff.notWorthRefactoring.butAnnoying | |
val y = Y.doSomeStuff.notWorthRefactoring.butAnnoying | |
// Now I can replace it with this satisfying pattern | |
val func = (_: String).doSomeStuff.notWorthRefactoring.butAnnoying | |
val (x, y) = (X, Y).bimap(func, func) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment