-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Description
Hi,
Given a nested chain of Options, is there a way to coerce the most inner one to Some?
The current operator .each allows traversing Options, but acts like map:
import com.softwaremill.quicklens._
case class C(d: Option[Int])
case class B(c: Option[C])
case class A(b: Option[B])
val a = A(b = None)
a.modify(_.b.each.c.each.d.each).setTo(3) // res0: A = A(None)(the result is A(None), but how can we achieve a A(Some(B(Some(C(Some(3))))))?)
It could be useful if there were some operator (say, all) which can act as follows:
a.modify(_.b.all.c.all.d.all).setTo(3) // res0: A = A(Some(B(Some(C(Some(3))))))Metadata
Metadata
Assignees
Labels
No labels