Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional patcher #37

Closed
piotrkosecki opened this issue Aug 21, 2017 · 0 comments
Closed

Optional patcher #37

piotrkosecki opened this issue Aug 21, 2017 · 0 comments
Assignees

Comments

@piotrkosecki
Copy link
Contributor

piotrkosecki commented Aug 21, 2017

Hi. Can you provide something like optional patcher? The idea would be to do something like this:

case class Foo(a: String, b: Int, c: Double)
case class Bar(a: Option[String], b: Option[Int])

val f = Foo("aaa", 123, 0.33)
val b = Bar(None, Some(987))
f.patchWithOpt(b) should be Foo("aaa", 987, 0.33) 

At the moment the way I can do it is:

f.copy(a = b.getOrElse(f.a), ...) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants