-
Notifications
You must be signed in to change notification settings - Fork 448
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
Arrow Optics ❤️ Compose #3299
Arrow Optics ❤️ Compose #3299
Conversation
kotlin { | ||
explicitApi() | ||
|
||
jvm { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Off-topic: @serras how do you feel about doing this explicitly in Arrow instead of relying on the arrowGradleConfig
?
Arrow Gradle Config came to live because of publishing, and I've in favor of replacing Arrow Gradle Config Nexus/Publish with https://github.com/vanniktech/gradle-maven-publish-plugin. I've tried it on a couple of my projects and it works better as what we have whilst supporting the same style of configuration we currently use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That sounds great (although having to define all the targets on each project seems tiresome). Maybe another thing to do in the arrow-2
branch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe another thing to do in the arrow-2 branch?
Was wondering if we could do something interesting in buildSrc
or something where we can define some top-level functions to avoid all the repetitive boilerplate. arrow-2 sounds good! Definitely not for 1.2.2 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome stuff @serras! 🙌
arrow-libs/optics/arrow-optics-compose/src/commonMain/kotlin/arrow/optics/Copy.kt
Outdated
Show resolved
Hide resolved
Kover Report
|
arrow-libs/optics/arrow-optics-compose/src/commonMain/kotlin/arrow/optics/Copy.kt
Outdated
Show resolved
Hide resolved
this@optic.collect { collector.emit(g.get(it)) } | ||
|
||
override val replayCache: List<A> | ||
get() = this@optic.replayCache.map { g.get(it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always contains single element.
get() = this@optic.replayCache.map { g.get(it) } | |
get() = listOf(value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to keep this implementation, since it makes it more clear that we are just reusing the replayCache
from the nested version.
get() = this@optic.subscriptionCount | ||
|
||
override val replayCache: List<A> | ||
get() = this@optic.replayCache.map { lens.get(it) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @serras, thank you for this great work! I just have one small thought.
These are a few utilities which help working with
MutableState
(as in Compose) using optics.