Created
August 22, 2017 12:08
-
-
Save MateuszKubuszok/ad411d1bd7bd27da2750c7108eae0d73 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
implicit final class OptMapOps[A](self: A) { | |
def optMap[B, C >: A](otherOpt: Option[B])(f: (A, B) => C): C = otherOpt match { | |
case Some(other) => f(self, other) | |
case None => self | |
} | |
} | |
// sequence.mapOps(optionalFilter) { case (seq, filter) => filter(seq) }.otherOps(args) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment