Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.