Luke
12/08/2022, 3:19 PM@optics
data class Foo(
val bar: Either<Throwable, Bar>,
}
How would I focus bar
only if it's a Either.Right
. I expected something like Foo.bar.right.modify(...)
to exist but it doesn't seem so...Luke
12/08/2022, 3:20 PMTies
12/08/2022, 3:27 PMLuke
12/08/2022, 3:42 PMAlejandro Serrano Mena
12/08/2022, 4:00 PMAlejandro Serrano Mena
12/08/2022, 4:00 PMsimon.vergauwen
12/09/2022, 7:43 AMsimon.vergauwen
12/09/2022, 7:44 AMCompanion
of Prism
. It probably also deserves specialised syntax in the DSL. Such that you can do.
Foo.bar.right.modify(foo) { bar -> ... }
instead of
(Foo.bar compose pRight()).modify(bar) { bar -> ... }
simon.vergauwen
12/09/2022, 7:45 AMFeel free to open an issue if you cannot find themI'd also be happy to help if you're interested in contributing this improvement! Feel free to DM me, or ask any questions in #arrow-contributors if you're not sure what to do to contribute. Here is the contribution guide on Github, https://github.com/arrow-kt/arrow/blob/main/CONTRIBUTING.md
Luke
12/09/2022, 2:28 PM